FerroUI/ docs

Search guides, controls, Rust APIs, and XAML.

    GitHub ↗

    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.

    View source

    Members

    default_template

    fn default_template() -> Rc<FuncDataTemplate>
    

    The default data template used in the case where no matching data template is found.

    Source

    access

    fn access() -> Rc<FuncDataTemplate>
    

    The implementation of default_template for data that displays an access key.

    Source

    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.

    Source

    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.

    Source

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

    Source

    Trait implementations

    Availability

    Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.