Enum fui_core::Children

source ·
pub enum Children {
    None,
    SingleStatic(Rc<RefCell<dyn ControlObject>>),
    MultipleStatic(Vec<Rc<RefCell<dyn ControlObject>>>),
    SingleDynamic(Box<dyn ObservableCollection<Rc<RefCell<dyn ControlObject>>>>),
}
Expand description

Children is a collection of controls.

The collection is an enum to make it optimized for the cases with having static list of controls.

Variants§

§

None

The collection has no items.

§

SingleStatic(Rc<RefCell<dyn ControlObject>>)

The collection has a single child.

§

MultipleStatic(Vec<Rc<RefCell<dyn ControlObject>>>)

The collection is a list of controls.

§

SingleDynamic(Box<dyn ObservableCollection<Rc<RefCell<dyn ControlObject>>>>)

The children comes from a single observable collection.

Implementations§

source§

impl Children

source

pub fn empty() -> Self

Creates an empty children collection.

source

pub fn from(children_vec: Vec<Children>) -> Self

Constructs Children collection from vector of Children collections.

source

pub fn len(&self) -> usize

Returns number of controls in the children collection.

source

pub fn get(&self, index: usize) -> Option<Rc<RefCell<dyn ControlObject>>>

Tries to get Rc reference to the control at the index position.

Trait Implementations§

source§

impl<T: ControlObject + 'static> From<Rc<RefCell<T>>> for Children

Converts a single control to Children collection.

source§

fn from(item: Rc<RefCell<T>>) -> Children

Converts to this type from the input type.
source§

impl From<Rc<RefCell<dyn ControlObject>>> for Children

Converts a single control to Children collection.

source§

fn from(item: Rc<RefCell<dyn ControlObject>>) -> Children

Converts to this type from the input type.
source§

impl<T: Into<Box<dyn ObservableCollection<Rc<RefCell<dyn ControlObject>>>>>> From<T> for Children

Converts an observable collection to Children collection.

source§

fn from(items: T) -> Children

Converts to this type from the input type.
source§

impl<T: 'static + ControlObject> From<Vec<Rc<RefCell<T>>>> for Children

Converts vector of controls to Children collection.

source§

fn from(items: Vec<Rc<RefCell<T>>>) -> Children

Converts to this type from the input type.
source§

impl From<Vec<Rc<RefCell<dyn ControlObject>>>> for Children

Converts vector of controls to Children collection.

source§

fn from(items: Vec<Rc<RefCell<dyn ControlObject>>>) -> Children

Converts to this type from the input type.
source§

impl<'a> IntoIterator for &'a Children

§

type Item = Rc<RefCell<dyn ControlObject>>

The type of the elements being iterated over.
§

type IntoIter = ChildrenIterator<'a>

Which kind of iterator are we turning this into?
source§

fn into_iter(self) -> ChildrenIterator<'a>

Creates an iterator from a value. Read more
source§

impl ObservableCollection<Rc<RefCell<dyn ControlObject>>> for Children

ObservableCollection for Children.

Auto Trait Implementations§

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, TSrcColl> ObservableCollectionExt<T> for TSrcColl
where T: 'static + Clone, TSrcColl: ObservableCollection<T> + 'static,

source§

fn map<TDst, F>(&self, f: F) -> ObservableCollectionMap<TDst>
where TDst: 'static + Clone, F: 'static + Fn(&T) -> TDst,

Map creates new observable collection.

It keeps mapped copy of every item.

The only connection between it and original observable collection is by subscribing on the on_changed event of the source collection, so we don’t have to keep implicit reference to the source collection. The on_change event of source collection keeps a weak reference to our handler.

source§

impl<TSrc, TSrcColl> ObservableCollectionFlatMapExt<TSrc> for TSrcColl
where TSrc: Clone + 'static, TSrcColl: ObservableCollection<TSrc> + 'static,

source§

fn flat_map<TDst, TDstColl, F>(&self, f: F) -> ObservableCollectionFlatMap<TDst>
where TDst: Clone + 'static, TDstColl: ObservableCollection<TDst> + IntoIterator<Item = TDst>, F: FnMut(&TSrc) -> TDstColl + 'static,

Flat map creates new observable collection.

It keeps mapped copy of every item.

The only connection between it and original observable collection is by subscribing on the on_changed event of the source collection, so we don’t have to keep implicit reference to the source collection. The on_change event of source collection keeps a weak reference to our handler.

source§

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

§

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

§

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.
source§

impl<T> UnsafeAny for T
where T: Any,