FerroUI/ docs

Search guides, controls, Rust APIs, and XAML.

    GitHub ↗

    OnFormFactorExtensionBase

    struct · ferroui-markup-xaml · v0.5.0

    struct OnFormFactorExtensionBase<TReturn>
    

    Provides a value depending on the form factor of the device the application runs on (desktop, mobile, TV).

    The non-generic and the generic class of the managed original are this one type: OnFormFactorExtension is the instantiation for any value, OnFormFactorExtensionOf 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

    desktop

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

    Source

    set_desktop

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

    Source

    mobile

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

    Source

    set_mobile

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

    Source

    tv

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

    Source

    set_tv

    fn set_tv(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(service_provider: &Rc<dyn IServiceProvider>, option: FormFactorType) -> bool
    

    Whether the branch for option is the one to provide: whether the runtime platform service of service_provider reports that form factor.

    Panics

    Panics if service_provider is a root service provider and no runtime platform was registered (the service lookup of the managed original throws). Use try_should_provide_option to handle it.

    Source

    try_should_provide_option

    fn try_should_provide_option(service_provider: &Rc<dyn IServiceProvider>, option: FormFactorType) -> Result<bool, crate::XamlLoadError>
    

    should_provide_option without the panic.

    Source

    Trait implementations

    Availability

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