pub struct Emitter {
pub out: Box<dyn Write>,
pub config_data: Figment,
pub workdir: Utf8PathBuf,
}
Fields§
§out: Box<dyn Write>
§config_data: Figment
§workdir: Utf8PathBuf
Implementations§
Source§impl Emitter
impl Emitter
Sourcepub fn config_val(&self, key: &str) -> Result<String, EmitError>
pub fn config_val(&self, key: &str) -> Result<String, EmitError>
Fetch a configuration value, or panic if it’s missing.
Sourcepub fn config_or(&self, key: &str, default: &str) -> String
pub fn config_or(&self, key: &str, default: &str) -> String
Fetch a configuration value, using a default if it’s missing.
Sourcepub fn config_var(&mut self, name: &str, key: &str) -> EmitResult
pub fn config_var(&mut self, name: &str, key: &str) -> EmitResult
Emit a Ninja variable declaration for name
based on the configured value for key
.
Sourcepub fn config_var_or(
&mut self,
name: &str,
key: &str,
default: &str,
) -> Result<()>
pub fn config_var_or( &mut self, name: &str, key: &str, default: &str, ) -> Result<()>
Emit a Ninja variable declaration for name
based on the configured value for key
, or a
default value if it’s missing.
Sourcepub fn var(&mut self, name: &str, value: &str) -> Result<()>
pub fn var(&mut self, name: &str, value: &str) -> Result<()>
Emit a Ninja variable declaration.
Sourcepub fn build(&mut self, rule: &str, input: &str, output: &str) -> Result<()>
pub fn build(&mut self, rule: &str, input: &str, output: &str) -> Result<()>
Emit a simple Ninja build command with one dependency.
Sourcepub fn build_cmd(
&mut self,
targets: &[&str],
rule: &str,
deps: &[&str],
implicit_deps: &[&str],
) -> Result<()>
pub fn build_cmd( &mut self, targets: &[&str], rule: &str, deps: &[&str], implicit_deps: &[&str], ) -> Result<()>
Emit a Ninja build command.
Sourcepub fn add_file(&self, name: &str, contents: &[u8]) -> Result<()>
pub fn add_file(&self, name: &str, contents: &[u8]) -> Result<()>
Add a file to the build directory.
Sourcepub fn external_path(&self, path: &Utf8Path) -> Utf8PathBuf
pub fn external_path(&self, path: &Utf8Path) -> Utf8PathBuf
Get a path to an external file. The input path
may be relative to our original
invocation; we make it relative to the build directory so it can safely be used in the
Ninja file.
Auto Trait Implementations§
impl Freeze for Emitter
impl !RefUnwindSafe for Emitter
impl !Send for Emitter
impl !Sync for Emitter
impl Unpin for Emitter
impl !UnwindSafe for Emitter
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more