Skip to main content

DynWebviewAttributes

Struct DynWebviewAttributes 

Source
pub struct DynWebviewAttributes(/* private fields */);
Expand description

The runtime-specific webview attributes of the selected runtime, see Runtime::RuntimeWebviewAttributes.

Holds the attributes type of the runtime in use (e.g. tauri_runtime_wry::WryWebviewAttributes) once one of the runtime’s extension traits sets them through DynWebviewAttributes::get_or_default. Until then the runtime uses its default attributes.

Implementations§

Source§

impl DynWebviewAttributes

Source

pub fn new<A: Any + Send + Sync>(attributes: A) -> Self

Wraps the attributes of the runtime in use.

Source

pub fn is<A: Any>(&self) -> bool

Whether the attributes are of type A.

Source

pub fn downcast_ref<A: Any>(&self) -> Option<&A>

Returns a reference to the attributes if they are of type A.

Source

pub fn get_or_default<A: Any + Default + Send + Sync>( &mut self, ) -> Option<&mut A>

Returns the attributes as type A, initializing them with A::default() when none were set yet.

Returns None when attributes of another runtime were already set.

Source

pub fn downcast<A: Any + Default>(self) -> Result<A>

Unwraps the attributes as type A, using A::default() when none were set.

Fails when attributes of another runtime were set.

Trait Implementations§

Source§

impl Debug for DynWebviewAttributes

Source§

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

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

impl Default for DynWebviewAttributes

Source§

fn default() -> DynWebviewAttributes

Returns the “default value” for a type. Read more

Auto Trait Implementations§

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> 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, 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.