Skip to main content

Condition

Struct Condition 

Source
pub struct Condition<'a> { /* private fields */ }
Expand description

Conditionally print items based on a condition.

These conditions are extremely flexible and can even be resolved based on information found later on in the file.

Implementations§

Source§

impl<'a> Condition<'a>

Source

pub fn new(name: &'static str, properties: ConditionProperties<'a>) -> Self

Source

pub fn new_true() -> Self

Source

pub fn new_false() -> Self

Source

pub fn unique_id(&self) -> u32

Source

pub fn name(&self) -> &'static str

Source

pub fn true_path(&self) -> &Option<PrintItemPath<'a>>

Source

pub fn false_path(&self) -> &Option<PrintItemPath<'a>>

Source

pub fn create_reference(&mut self) -> ConditionReference

Source

pub fn create_reevaluation(&mut self) -> ConditionReevaluation

Source

pub fn set_unknown_same_as_false(&mut self)

Says that what’s printed when the condition isn’t resolved yet is the same as when it’s false, including by the conditions using its value. When it looked ahead and turns out to be false, the printer then doesn’t go back to print the same thing again.

This is only needed when the condition has a reference, since the printer already doesn’t go back to a condition without one when it takes the same path as before.

Trait Implementations§

Source§

impl<'a> Clone for Condition<'a>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'a> IntoPrintItems<'a> for Condition<'a>

Source§

fn into_print_items(self, arena: &'a Arena) -> PrintItems<'a>

Auto Trait Implementations§

§

impl<'a> !RefUnwindSafe for Condition<'a>

§

impl<'a> !Send for Condition<'a>

§

impl<'a> !Sync for Condition<'a>

§

impl<'a> !UnwindSafe for Condition<'a>

§

impl<'a> Forget for Condition<'a>

§

impl<'a> Freeze for Condition<'a>

§

impl<'a> Unpin for Condition<'a>

§

impl<'a> UnsafeUnpin for Condition<'a>

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.