FuncDataTemplate
struct · ferroui-controls · v0.5.0
struct FuncDataTemplate
Builds a control for a piece of data.
The typed constructors (for_type and friends) take
the place of the generic class of the same name: they match data that can
be cast to T, and null data when T accepts null.
Members
default_template
fn default_template() -> Rc<FuncDataTemplate>
The default data template used in the case where no matching data template is found.
access
fn access() -> Rc<FuncDataTemplate>
The implementation of default_template
for data that displays an access key.
new
fn new(match_: impl Fn(Option<&BoxedValue>) -> bool + 'static, build: impl Fn(&Option<BoxedValue>, &NameScopeRef) -> Option<Ref<Control>> + 'static, supports_recycling: bool) -> Rc<Self>
Creates a data template.
match_ determines whether the data template matches the specified
data and build returns a control when supplied with data matching
the template and the name scope of the built content.
for_type
fn for_type<T: 'static>(build: impl Fn(&T, &NameScopeRef) -> Option<Ref<Control>> + 'static, supports_recycling: bool) -> Rc<Self>
Creates a data template that matches data of type T.
for_type_with_match
fn for_type_with_match<T: 'static>(match_: impl Fn(&T) -> bool + 'static, build: impl Fn(&T, &NameScopeRef) -> Option<Ref<Control>> + 'static, supports_recycling: bool) -> Rc<Self>
Creates a data template that matches data of type T accepted by
match_.
Trait implementations
SendSyncFreezeUnsafeUnpinUnpinUnwindSafeRefUnwindSafeBorrow<T>BorrowMut<T>Into<U>From<T>TryInto<U>TryFrom<U>AnyClassDefaultsErasedDestructorIntoEitherITemplateWithParam<Option<Rc<dyn AnyValue>>, Option<Ref<Control>>>IDataTemplateIRecyclingDataTemplate
Availability
Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.