FerroUI/ docs

Search guides, controls, Rust APIs, and XAML.

    GitHub ↗

    TemplateContent

    struct · ferroui-markup-xaml · v0.5.0

    struct TemplateContent
    

    Builds the content of templates.

    View source

    Members

    load

    fn load(template_content: Option<&BoxedValue>) -> Option<TemplateResult<Ref<Control>>>
    

    Builds template content whose result is a control.

    Source

    load_as

    fn load_as<T: Clone + 'static>(template_content: Option<&BoxedValue>) -> Option<TemplateResult<T>>
    

    Builds template content (the value of a Content property marked as template content) whose result is a T: the result and the name scope its named elements were registered in.

    Returns None for no content, and for content that built nothing.

    The content is the deferred content object the runtime helpers create (DeferredContent). The delegate form of the managed original has no counterpart: a function is not an untyped value.

    Inside an error scope of a load (with_xaml_errors), a failure is the error of the scope and the template builds nothing.

    Panics

    Outside an error scope, panics if the content is anything else, or if what it built is not a T.

    Source

    try_load_as

    fn try_load_as<T: Clone + 'static>(template_content: Option<&BoxedValue>) -> Result<Option<TemplateResult<T>>, XamlLoadError>
    

    load_as without panics: unexpected content and a result of another type are errors. This is what untyped (metadata) callers use.

    Source

    Trait implementations

    • Send
    • Sync
    • Freeze
    • UnsafeUnpin
    • Unpin
    • UnwindSafe
    • RefUnwindSafe
    • Borrow<T>
    • BorrowMut<T>
    • Into<U>
    • From<T>
    • TryInto<U>
    • TryFrom<U>
    • Any
    • ClassDefaults
    • ErasedDestructor
    • IntoEither
    • MarkupTyped

    Availability

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