Skip to main content

SourceFiles

Trait SourceFiles 

Source
pub trait SourceFiles {
    // Required methods
    fn read(&mut self, name: &str) -> Option<Vec<u8>>;
    fn exists(&mut self, name: &str) -> bool;

    // Provided method
    fn decode(&mut self, charset: &str, bytes: &[u8]) -> Option<Vec<u8>> { ... }
}
Expand description

How the preprocessor gets at source files.

Required Methods§

Source

fn read(&mut self, name: &str) -> Option<Vec<u8>>

The contents of a file, or None if it cannot be read.

Source

fn exists(&mut self, name: &str) -> bool

Whether a file is there to be read.

Provided Methods§

Source

fn decode(&mut self, charset: &str, bytes: &[u8]) -> Option<Vec<u8>>

Text in a named character set, as UTF-8, or None if the set is not known. The compiler knows ASCII, UTF-8, UTF-16, and Latin-1 itself, and asks here for any other that a source file’s #charset names.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§