pub struct Conditional<C: RepeatedItemTree> { /* private fields */ }Implementations§
Source§impl<C: RepeatedItemTree + 'static> Conditional<C>
impl<C: RepeatedItemTree + 'static> Conditional<C>
Sourcepub fn ensure_updated(
self: Pin<&Self>,
init: impl Fn() -> VRc<ItemTreeVTable, C>,
)
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
Sourcepub fn set_model_binding(&self, binding: impl Fn() -> bool + 'static)
pub fn set_model_binding(&self, binding: impl Fn() -> bool + 'static)
Set the model binding
Sourcepub fn visit(
&self,
order: TraversalOrder,
visitor: ItemVisitorRefMut<'_>,
) -> VisitChildrenResult
pub fn visit( &self, order: TraversalOrder, visitor: ItemVisitorRefMut<'_>, ) -> VisitChildrenResult
Call the visitor for the root of each instance
Sourcepub fn len(&self) -> usize
pub fn len(&self) -> usize
Return the amount of instances (1 if the conditional is active, 0 otherwise)
Sourcepub fn range(&self) -> Range<usize>
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.
Sourcepub fn instance_at(&self, index: usize) -> Option<VRc<ItemTreeVTable, C>>
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()
Sourcepub fn instances_vec(&self) -> Vec<VRc<ItemTreeVTable, C>>
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>
impl<C: RepeatedItemTree> Default for Conditional<C>
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>
impl<C> !Sync for Conditional<C>
impl<C> UnwindSafe for Conditional<C>where
C: RefUnwindSafe,
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