FerroUI/ docs

Search guides, controls, Rust APIs, and XAML.

    GitHub ↗

    OnPlatformExtensionBase

    struct · ferroui-markup-xaml · v0.5.0

    struct OnPlatformExtensionBase<TReturn>
    

    Provides a value depending on the operating system the application runs on:

    <TextBlock Text="{OnPlatform Default='Hello', Windows='Hello Windows'}" />
    

    The markup compiler replaces the extension with a branch per option that asks should_provide_option; the object itself only carries the declared options.

    The non-generic and the generic class of the managed original are this one type: OnPlatformExtension is the instantiation for any value, OnPlatformExtensionOf the typed one.

    View source

    Members

    new

    fn new() -> Rc<Self>
    

    Source

    with_default

    fn with_default(default_value: Option<TReturn>) -> Rc<Self>
    

    Creates the extension with its default value.

    Source

    default

    fn default(self: &Self) -> Option<TReturn>
    

    The value used when no option applies.

    Source

    set_default

    fn set_default(self: &Self, value: Option<TReturn>)
    

    Source

    windows

    fn windows(self: &Self) -> Option<TReturn>
    

    Source

    set_windows

    fn set_windows(self: &Self, value: Option<TReturn>)
    

    Source

    mac_os

    fn mac_os(self: &Self) -> Option<TReturn>
    

    Source

    set_mac_os

    fn set_mac_os(self: &Self, value: Option<TReturn>)
    

    Source

    linux

    fn linux(self: &Self) -> Option<TReturn>
    

    Source

    set_linux

    fn set_linux(self: &Self, value: Option<TReturn>)
    

    Source

    android

    fn android(self: &Self) -> Option<TReturn>
    

    Source

    set_android

    fn set_android(self: &Self, value: Option<TReturn>)
    

    Source

    ios

    fn ios(self: &Self) -> Option<TReturn>
    

    Source

    set_ios

    fn set_ios(self: &Self, value: Option<TReturn>)
    

    Source

    browser

    fn browser(self: &Self) -> Option<TReturn>
    

    Source

    set_browser

    fn set_browser(self: &Self, value: Option<TReturn>)
    

    Source

    provide_value

    fn provide_value(self: &Rc<Self>) -> Rc<Self>
    

    Required for the compiler, which replaces the call with the selected branch at compile time.

    Source

    should_provide_option

    fn should_provide_option(option: &str) -> bool
    

    Whether the branch for option is the one to provide on the operating system the application runs on.

    Source

    Trait implementations

    Availability

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