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.
Members
newwith_defaultdefaultset_defaultwindowsset_windowsmac_osset_mac_oslinuxset_linuxandroidset_androidiosset_iosbrowserset_browserprovide_valueshould_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>)
windows
fn windows(self: &Self) -> Option<TReturn>
set_windows
fn set_windows(self: &Self, value: Option<TReturn>)
mac_os
fn mac_os(self: &Self) -> Option<TReturn>
set_mac_os
fn set_mac_os(self: &Self, value: Option<TReturn>)
linux
fn linux(self: &Self) -> Option<TReturn>
set_linux
fn set_linux(self: &Self, value: Option<TReturn>)
android
fn android(self: &Self) -> Option<TReturn>
set_android
fn set_android(self: &Self, value: Option<TReturn>)
ios
fn ios(self: &Self) -> Option<TReturn>
set_ios
fn set_ios(self: &Self, value: Option<TReturn>)
browser
fn browser(self: &Self) -> Option<TReturn>
set_browser
fn set_browser(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(option: &str) -> bool
Whether the branch for option is the one to provide on the
operating system the application runs on.
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.