Skip to main content

NativeProp

Enum NativeProp 

Source
pub enum NativeProp {
Show 26 variants Disabled(bool), Source(WebSource), Src(Option<Arc<str>>), Poster(Option<Arc<str>>), Html(Option<Arc<str>>), BaseUrl(Option<Arc<str>>), AllowOrigin(Option<Arc<str>>), AllowNavigation(Option<Vec<Arc<str>>>), InjectedJavaScript(Option<Arc<str>>), InjectedJavaScriptBefore(Option<Arc<str>>), UserAgent(Option<Arc<str>>), Scrollable(bool), JavaScriptEnabled(bool), BackForwardGestures(bool), Incognito(bool), Zoomable(bool), UrlSchemes(Vec<WebUrlScheme>), Paused(bool), Muted(bool), Volume(f32), Rate(f32), Repeat(bool), VideoResizeMode(ResizeMode), Controls(bool), ProgressInterval(f32), AudioSession(AudioSession), // some variants omitted
}
Expand description

A property of a native control.

Variants§

§

Disabled(bool)

disabled (any element): ignores presses (no press feedback either), applies disabled: classes, disables controls, and screen readers say it is disabled (its accessibility state).

§

Source(WebSource)

What a web view or video loads, as Rust sets it (TS sets src, html and baseUrl).

§

Src(Option<Arc<str>>)

src of a web view or video: the URL it loads.

§

Poster(Option<Arc<str>>)

poster (videos): an image shown until the video’s first frame is ready.

§

Html(Option<Arc<str>>)

html (web views): the page to show instead of loading src.

§

BaseUrl(Option<Arc<str>>)

baseUrl (web views): the URL the relative links of html resolve against.

§

AllowOrigin(Option<Arc<str>>)

allowOrigin (web views): one more origin this web view may show and navigate to besides webview.hosts, for an origin known only while the app runs: scheme://host[:port], http or https, matched exactly (crate::access::WebOrigin). It needs "runtimeOrigin": true in capabilities.webview; another value or no grant is refused with a message and the web view has none. Set with src in the same render, it applies to that src; changed later, it applies from the next navigation. Other web views and the windows a page opens do not have it.

§

AllowNavigation(Option<Vec<Arc<str>>>)

allowNavigation (web views): the hosts this web view may show and navigate to, narrower than webview.hosts: the same host patterns (*, *.example.com, a host name), and an empty list refuses every web page (crate::access::WebHosts). The platform refuses any other http or https page before its request is made and reports onError with ERR_ACCESS_DENIED and the url. It never widens the app’s grant. A list with a pattern that does not read is refused with a message and the web view is not narrowed.

§

InjectedJavaScript(Option<Arc<str>>)

injectedJavaScript (web views): runs after each page loads.

§

InjectedJavaScriptBefore(Option<Arc<str>>)

injectedJavaScriptBeforeContentLoaded (web views): runs before each page’s own scripts.

§

UserAgent(Option<Arc<str>>)

userAgent (web views): the browser’s user agent string.

§

Scrollable(bool)

scrollable: the user can scroll it (default true).

§

JavaScriptEnabled(bool)

javaScriptEnabled (web views): pages run scripts (default true).

§

BackForwardGestures(bool)

allowsBackForwardNavigationGestures (iOS web views; desktop ones on macOS, with two-finger trackpad swipes): swipe back and forward.

§

Incognito(bool)

incognito (web views): the page’s website data (cookies, storage, the cache) lives only as long as the web view, apart from the app’s other web views; on Android, where every web view shares the app’s cookies and storage, it loads without the HTTP cache and saves no form data. Read when the web view is made; a later change is ignored (with a warning): render a new element to change it.

§

Zoomable(bool)

zoomable (web views): the person can pinch to zoom the page, also past the scale limits of its viewport (Android’s built-in zoom with no on-screen buttons, WebKit ignoring the viewport’s scale limits on iOS, magnification on macOS). False keeps each platform’s own behavior: Android and macOS do not zoom, iOS zooms as far as the page’s viewport allows, WebView2 (Windows) zooms by default. Read when the web view is made, as incognito.

§

UrlSchemes(Vec<WebUrlScheme>)

The URL schemes a web view serves from the app (Rust’s WebView::url_scheme). Read when the web view is made, as incognito.

§

Paused(bool)

paused (videos): playback is paused.

§

Muted(bool)

muted (videos): no sound.

§

Volume(f32)

volume (videos): 0..1.

§

Rate(f32)

rate (videos): the playback speed.

§

Repeat(bool)

repeat (videos): plays again from the start at the end.

§

VideoResizeMode(ResizeMode)

How a video fits its box (objectFit, a Rust resize_mode).

§

Controls(bool)

controls (videos): the platform’s playback controls.

§

ProgressInterval(f32)

progressUpdateInterval (videos): milliseconds between onProgress events (250 by default).

§

AudioSession(AudioSession)

audioSession (videos): what the sound does to the rest of the device’s audio while it plays ("default" when unset: the app’s audio settings).

Trait Implementations§

Source§

impl Clone for NativeProp

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for NativeProp

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl HostProps for NativeProp

Source§

fn decode<I: HostInput>( name: &str, input: &I, cx: &mut HostCx, ) -> Option<Option<Self>>

The prop JS name name sets with input: None for a name that is not one of these props, Some(None) when nothing is to be set.
Source§

fn reset(&self) -> Option<Self>

This prop at its default (what clearing it from JS sets); None for the props the runtime sets once.
Source§

fn same_kind(&self, other: &Self) -> bool

Whether self and other set the same property.
Source§

fn specs(types: &mut TsTypes, out: &mut Vec<HostPropSpec>)

The props, for the generated TypeScript.
Source§

impl PartialEq for NativeProp

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for NativeProp

Auto Trait Implementations§

§

impl !RefUnwindSafe for NativeProp

§

impl !UnwindSafe for NativeProp

§

impl Forget for NativeProp

§

impl Freeze for NativeProp
where *const ArcInner<str> is !null: Freeze, PhantomData<ArcInner<str>>: Freeze, *const u8 is !null: Freeze, PhantomData<Arc<str>>: Freeze, PhantomData<WebUrlScheme>: Freeze,

§

impl Move for NativeProp

§

impl Send for NativeProp
where Arc<str>: Send, RawVecInner: Send, Arc<dyn Fn(WebResourceRequest) + Sync + Send>: Send,

§

impl Sync for NativeProp
where Arc<str>: Sync, RawVecInner: Sync, Arc<dyn Fn(WebResourceRequest) + Sync + Send>: Sync,

§

impl Unpin for NativeProp
where Arc<str>: Unpin, *const u8 is !null: Unpin, Arc<dyn Fn(WebResourceRequest) + Sync + Send>: Unpin,

§

impl UnsafeUnpin for NativeProp
where *const ArcInner<str> is !null: UnsafeUnpin, PhantomData<ArcInner<str>>: UnsafeUnpin, *const u8 is !null: UnsafeUnpin, PhantomData<Arc<str>>: UnsafeUnpin, PhantomData<WebUrlScheme>: UnsafeUnpin,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.