Skip to main content

Pool

Struct Pool 

Source
pub struct Pool {
    pub name: String,
    pub variables: AddOnlyVec<Variable>,
}
Expand description

A pool, as defined by the pool keyword

See https://ninja-build.org/manual.html#ref_pool

§Example

use ninja_writer::*;

let ninja = Ninja::new();
let expensive = ninja.pool("expensive", 4)
    .variable("foo", "bar");

let compile = ninja.rule("compile", "gcc $cflags -c $in -o $out").pool(&expensive);

assert_eq!(ninja.to_string(), r###"
pool expensive
  depth = 4
  foo = bar

rule compile
  command = gcc $cflags -c $in -o $out
  pool = expensive
"###);

Fields§

§name: String

Name of the pool

§variables: AddOnlyVec<Variable>

The list of variables, as an indented block

Currently the only useful variable is depth

Implementations§

Source§

impl Pool

Source

pub fn new(name: impl ToArg, depth: usize) -> Self

Create a pool with a given name and depth

Source

pub fn add_to(self, ninja: &Ninja) -> PoolRef

Add the pool to a ninja file

Trait Implementations§

Source§

impl AsRef<Pool> for PoolRef

Source§

fn as_ref(&self) -> &Pool

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl Debug for Pool

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for Pool

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Variables for Pool

Source§

fn add_variable_internal(&self, v: Variable)

Add a variable Read more
Source§

fn variable(self, name: impl ToArg, value: impl ToArg) -> Self

Add a variable to the current scope

Auto Trait Implementations§

§

impl !Freeze for Pool

§

impl !RefUnwindSafe for Pool

§

impl !Sync for Pool

§

impl Send for Pool

§

impl Unpin for Pool

§

impl UnsafeUnpin for Pool

§

impl UnwindSafe for Pool

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.