pub struct Access<'a, T: 'static, D: HasData + ?Sized = HasSelf<T>> { /* private fields */ }Available on crate features 
runtime and component-model and component-model-async only.Expand description
Provides access to either store data (via the get method) or the store
itself (via AsContext/AsContextMut), as well as the component
instance to which the current host task belongs.
See Accessor::with for details.
Implementations§
Source§impl<'a, T, D> Access<'a, T, D>
 
impl<'a, T, D> Access<'a, T, D>
Sourcepub fn new(
    store: StoreContextMut<'a, T>,
    get_data: fn(&mut T) -> D::Data<'_>,
) -> Self
 
pub fn new( store: StoreContextMut<'a, T>, get_data: fn(&mut T) -> D::Data<'_>, ) -> Self
Creates a new Access from its component parts.
Sourcepub fn spawn(&mut self, task: impl AccessorTask<T, D, Result<()>>) -> JoinHandle ⓘwhere
    T: 'static,
 
pub fn spawn(&mut self, task: impl AccessorTask<T, D, Result<()>>) -> JoinHandle ⓘwhere
    T: 'static,
Spawn a background task.
See Accessor::spawn for details.
Trait Implementations§
Source§impl<'a, T, D> AsContext for Access<'a, T, D>
 
impl<'a, T, D> AsContext for Access<'a, T, D>
Source§fn as_context(&self) -> StoreContext<'_, T>
 
fn as_context(&self) -> StoreContext<'_, T>
Returns the store context that this type provides access to.
Source§impl<'a, T, D> AsContextMut for Access<'a, T, D>
 
impl<'a, T, D> AsContextMut for Access<'a, T, D>
Source§fn as_context_mut(&mut self) -> StoreContextMut<'_, T>
 
fn as_context_mut(&mut self) -> StoreContextMut<'_, T>
Returns the store context that this type provides access to.
Auto Trait Implementations§
impl<'a, T, D> Freeze for Access<'a, T, D>where
    D: ?Sized,
impl<'a, T, D = HasSelf<T>> !RefUnwindSafe for Access<'a, T, D>
impl<'a, T, D> Send for Access<'a, T, D>
impl<'a, T, D> Sync for Access<'a, T, D>
impl<'a, T, D> Unpin for Access<'a, T, D>where
    D: ?Sized,
impl<'a, T, D = HasSelf<T>> !UnwindSafe for Access<'a, T, D>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
    T: ?Sized,
 
impl<T> BorrowMut<T> for Twhere
    T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
 
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
 
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
 
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts 
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
 
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts 
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more