Conditional

Struct Conditional 

Source
pub struct Conditional<C: RepeatedItemTree> { /* private fields */ }

Implementations§

Source§

impl<C: RepeatedItemTree + 'static> Conditional<C>

Source

pub fn ensure_updated( self: Pin<&Self>, init: impl Fn() -> VRc<ItemTreeVTable, C>, )

Call this function to make sure that the model is updated. The init function is the function to create a ItemTree

Source

pub fn set_model_binding(&self, binding: impl Fn() -> bool + 'static)

Set the model binding

Source

pub fn visit( &self, order: TraversalOrder, visitor: ItemVisitorRefMut<'_>, ) -> VisitChildrenResult

Call the visitor for the root of each instance

Source

pub fn len(&self) -> usize

Return the amount of instances (1 if the conditional is active, 0 otherwise)

Source

pub fn range(&self) -> Range<usize>

Return the range of indices used by this Conditional.

Similar to Repeater::range, but the range is always [0, 1] if the Conditional is active.

Source

pub fn instance_at(&self, index: usize) -> Option<VRc<ItemTreeVTable, C>>

Return the instance for the given model index. The index should be within Self::range()

Source

pub fn is_empty(&self) -> bool

Return true if the Repeater as empty

Source

pub fn instances_vec(&self) -> Vec<VRc<ItemTreeVTable, C>>

Returns a vector containing all instances

Trait Implementations§

Source§

impl<C: RepeatedItemTree> Default for Conditional<C>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'pin, C: RepeatedItemTree> Unpin for Conditional<C>
where PinnedFieldsOf<__Conditional<'pin, C>>: Unpin,

Auto Trait Implementations§

§

impl<C> !Freeze for Conditional<C>

§

impl<C> !RefUnwindSafe for Conditional<C>

§

impl<C> Send for Conditional<C>
where C: Send + Sync,

§

impl<C> !Sync for Conditional<C>

§

impl<C> UnwindSafe for Conditional<C>
where C: RefUnwindSafe,

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, 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.