Skip to main content

Sys

Trait Sys 

Source
pub trait Sys {
    // Required methods
    fn write(&self, stream: Stream, s: &str) -> Result<()>;
    fn real_path(&self, path: &Path) -> Option<PathBuf>;
    fn read_source(&self, path: &Path) -> Option<String>;
    fn var(&self, name: &str) -> Option<String>;
    fn vars(&self) -> Vec<(String, String)>;
    fn exit(&self, code: i32) -> !;
}
Expand description

The system surface a host offers Elly: output, module sources, the environment and the way out. The resolver and IO reach the outside world only through this.

Required Methods§

Source

fn write(&self, stream: Stream, s: &str) -> Result<()>

Write s to stream and flush it.

Source

fn real_path(&self, path: &Path) -> Option<PathBuf>

The canonical form of path, with symlinks resolved, or None if there is nothing there. A resolved module’s canonical name is its real path.

Source

fn read_source(&self, path: &Path) -> Option<String>

The text of the file at path, or None if it is not a readable UTF-8 file.

Source

fn var(&self, name: &str) -> Option<String>

The environment variable name, if it is set and UTF-8.

Source

fn vars(&self) -> Vec<(String, String)>

The whole environment. Entries whose name or value is not UTF-8 are dropped: Elly strings are UTF-8, and a map that silently lost a key is better than a startup that refuses to run.

Source

fn exit(&self, code: i32) -> !

End the process with code, immediately.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§