FerroUI/ docs

Search guides, controls, Rust APIs, and XAML.

    GitHub ↗

    FerroRuntimeXamlLoader

    struct · ferroui-markup-xaml-loader · v0.5.0

    struct FerroRuntimeXamlLoader
    

    Loads XAML at run time.

    Every failure of a load (parsing, transforming, interpreting the document, a member or markup extension that fails) is a XamlLoadError: its message carries the line and position, its inner error is the error of the compiler (xamlx::exceptions::XamlError).

    View source

    Members

    load

    fn load(xaml: &str, local_assembly: Option<&'static MarkupAssembly>, root_instance: Option<BoxedValue>, uri: Option<url::Url>, design_mode: bool) -> Result<BoxedValue, XamlLoadError>
    

    Loads XAML from a string.

    • local_assembly: the default assembly for clr-namespace:.
    • root_instance: the optional instance into which the XAML should be loaded.
    • uri: the URL of the XAML being loaded, which relative references in it are resolved against.
    • design_mode: whether the XAML is being loaded in design mode.

    Source

    load_stream

    fn load_stream(stream: Box<dyn Read>, local_assembly: Option<&'static MarkupAssembly>, root_instance: Option<BoxedValue>, uri: Option<url::Url>, design_mode: bool) -> Result<BoxedValue, XamlLoadError>
    

    Loads XAML from a stream of UTF-8 text.

    Source

    load_document

    fn load_document(document: RuntimeXamlLoaderDocument, configuration: Option<RuntimeXamlLoaderConfiguration>) -> Result<BoxedValue, XamlLoadError>
    

    Loads a document. Without a configuration the default one is used.

    Source

    load_group

    fn load_group(documents: Vec<RuntimeXamlLoaderDocument>, configuration: Option<RuntimeXamlLoaderConfiguration>) -> Result<Vec<Option<BoxedValue>>, XamlLoadError>
    

    Loads a group of documents that may refer to each other. Returns the loaded object of each input document, in order.

    Source

    parse

    fn parse(xaml: &str, local_assembly: Option<&'static MarkupAssembly>) -> Result<BoxedValue, XamlLoadError>
    

    Parses XAML from a string.

    Source

    parse_as

    fn parse_as<T: Clone + 'static>(xaml: &str, local_assembly: Option<&'static MarkupAssembly>) -> Result<T, XamlLoadError>
    

    Parses XAML from a string to an object of type T (the handle type of the object: Ref<Border>, Rc<Style>, ...). The cast of the managed original: an object of another type is an invalid cast.

    Source

    register_class_document

    fn register_class_document(class: &'static TypeInfo, uri: &str)
    

    States that the markup of class (the class its root element names with x:Class) is the document with the absolute URI uri, an asset of the crate. Process-wide; a later registration for the same class replaces the earlier one. See the module documentation.

    Source

    class_document

    fn class_document(class: &'static TypeInfo) -> Option<String>
    

    The URI of the document registered for class or, failing that, for the nearest of its base classes that has one.

    Source

    load_object

    fn load_object(instance: &BoxedValue, service_provider: Option<&Rc<dyn IServiceProvider>>) -> Result<(), XamlLoadError>
    

    Populates instance from the document registered for its class (register_class_document): what FerroXamlLoader::load_object does for a class without compiled markup.

    Source

    document_group

    fn document_group(uri_text: &str, type_name: &str) -> Result<DocumentGroup, XamlLoadError>
    

    The document at uri_text (of the class named type_name, for the errors) with every document it includes, directly or not, that the asset loader has, and the assembly of the document: the group the document of a class is loaded (and compiled) as.

    Source

    register

    fn register()
    

    Makes the run-time loader the loader FerroXamlLoader falls back to for documents without compiled markup (the IRuntimeXamlLoader service). An application or a test host calls this once per locator scope.

    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

    Availability

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