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.
Members
newwith_defaultdefaultset_defaultdesktopset_desktopmobileset_mobiletvset_tvprovide_valueshould_provide_optiontry_should_provide_option
new
fn new() -> Rc<Self>
with_default
fn with_default(default_value: Option<TReturn>) -> Rc<Self>
Creates the extension with its default value.
default
fn default(self: &Self) -> Option<TReturn>
The value used when no option applies.
set_default
fn set_default(self: &Self, value: Option<TReturn>)
desktop
fn desktop(self: &Self) -> Option<TReturn>
set_desktop
fn set_desktop(self: &Self, value: Option<TReturn>)
mobile
fn mobile(self: &Self) -> Option<TReturn>
set_mobile
fn set_mobile(self: &Self, value: Option<TReturn>)
tv
fn tv(self: &Self) -> Option<TReturn>
set_tv
fn set_tv(self: &Self, value: Option<TReturn>)
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.
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.
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.
Trait implementations
SendSyncFreezeUnsafeUnpinUnpinUnwindSafeRefUnwindSafeBorrow<T>BorrowMut<T>Into<U>From<T>TryInto<U>TryFrom<U>AnyAnyValueClassDefaultsErasedDestructorIntoEitherIAddChild<Rc<On<TReturn>>>PartialEq
Availability
Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.