Type Alias rsass::input::CargoContext

source ·
pub type CargoContext = Context<CargoLoader>;
Expand description

A file-system based Context for use in cargo build scripts.

This is very similar to a FsContext, but has a for_crate constructor that uses the CARGO_MANIFEST_DIR environment variable instead of the current working directory, and it prints cargo:rerun-if-changed messages for each path that it loads.

Aliased Type§

struct CargoContext { /* private fields */ }

Implementations§

source§

impl CargoContext

source

pub fn for_crate() -> Result<Self, LoadError>

Create a new Context, loading files based in the manifest directory of the current crate.

Relative paths will be resolved from the directory containing the manifest of your package. This assumes the program is called by cargo as a build script, so the CARGO_MANIFEST_DIR environment variable is set.

source

pub fn for_path(path: &Path) -> Result<(Self, SourceFile), LoadError>

Create a new Context and load a file.

The directory part of path is used as a base directory for the loader. If path is relative, it will be resolved from the directory containing the manifest of your package.

source

pub fn push_path(&mut self, path: &Path) -> Result<(), LoadError>

Add a path to search for files.

If path is relative, it will be resolved from the directory containing the manifest of your package.