Struct FXProxyAsync

Source
pub struct FXProxyAsync<B>
where B: FXBuilderWrapperAsync,
{ /* private fields */ }
Expand description

Container type for lazy fields

Implementations§

Source§

impl<B, E> FXProxyAsync<B>
where B: FXBuilderWrapperAsync<Error = E>, E: Debug,

Source

pub fn into_inner(self) -> Option<B::Value>

Consumes the container, returns the wrapped value or None if the container is empty

Source

pub fn is_set(&self) -> bool

Returns true if the container has a value.

Source

pub async fn lazy_init<'a>(&'a self, owner: &B::Owner)

Initialize the field without obtaining the lock by calling code. Note though that internally the lock is still required.

Source

pub async fn read<'a>( &'a self, owner: &B::Owner, ) -> RwLockReadGuard<'a, B::Value>

Lazy-initialize the field if necessary and return lock read guard for the inner value.

Panics if fallible field builder returns an error.

Source

pub async fn read_mut<'a>( &'a self, owner: &B::Owner, ) -> RwLockMappedWriteGuard<'a, B::Value>

Lazy-initialize the field if necessary and return lock write guard for the inner value.

Panics if fallible field builder returns an error.

Source

pub async fn try_read<'a>( &'a self, owner: &B::Owner, ) -> Result<RwLockReadGuard<'a, B::Value>, B::Error>

Lazy-initialize the field if necessary and return lock read guard for the inner value.

Return the same error, as fallible field builder if it errors out.

Source

pub async fn try_read_mut<'a>( &'a self, owner: &B::Owner, ) -> Result<RwLockMappedWriteGuard<'a, B::Value>, B::Error>

Lazy-initialize the field if necessary and return lock write guard for the inner value.

Return the same error, as fallible field builder if it errors out.

Source

pub async fn write<'a>(&'a self) -> FXWrLockGuardAsync<'a, B>

Provides write-lock to directly store the value. Never calls the lazy builder.

Source

pub async fn clear(&self) -> Option<B::Value>

Resets the container into unitialized state

Trait Implementations§

Source§

impl<B> Clone for FXProxyAsync<B>
where B: FXBuilderWrapperAsync + Clone, B::Value: Clone,

Source§

fn clone(&self) -> Self

Returns a copy of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<B, V> Debug for FXProxyAsync<B>
where B: FXBuilderWrapperAsync<Value = V>, V: Debug,

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<B> !Freeze for FXProxyAsync<B>

§

impl<B> !RefUnwindSafe for FXProxyAsync<B>

§

impl<B> Send for FXProxyAsync<B>
where <B as FXBuilderWrapper>::Value: Send, B: Send,

§

impl<B> Sync for FXProxyAsync<B>
where <B as FXBuilderWrapper>::Value: Send + Sync, B: Send + Sync,

§

impl<B> Unpin for FXProxyAsync<B>
where <B as FXBuilderWrapper>::Value: Unpin, B: Unpin,

§

impl<B> UnwindSafe for FXProxyAsync<B>
where <B as FXBuilderWrapper>::Value: UnwindSafe, B: UnwindSafe,

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, U> FXInto<U> for T
where U: FXFrom<T>,

Source§

fn fx_into(self) -> U

Source§

impl<T, U> FXTryInto<U> for T
where U: FXTryFrom<T>,

Source§

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

Source§

fn fx_try_into(self) -> Result<U, <T as FXTryInto<U>>::Error>

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> 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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.