pub struct Resource<K: 'static, T: 'static, E: 'static> { /* private fields */ }Expand description
A local Copy handle, invalidated with its Owner. Results use Rc so T/E need neither Clone nor PartialEq. Source reads track only the resource driver; reads in the loader are not dependencies of that driver.
Implementations§
Source§impl<K, T, E> Resource<K, T, E>
impl<K, T, E> Resource<K, T, E>
pub fn is_alive(self) -> bool
pub fn try_with<R>( self, read: impl FnOnce(&ResourceState<K, T, E>) -> R, ) -> Result<R, AccessError>
pub fn with<R>(self, read: impl FnOnce(&ResourceState<K, T, E>) -> R) -> R
pub fn try_get(self) -> Result<ResourceState<K, T, E>, AccessError>
pub fn get(self) -> ResourceState<K, T, E>
pub fn map<U: 'static>( self, mapper: impl Fn(&ResourceState<K, T, E>) -> U + 'static, ) -> Bond<U>
Sourcepub fn refresh(self) -> Result<(), AccessError>
pub fn refresh(self) -> Result<(), AccessError>
Queue one fresh request. Repeated calls in a batch coalesce. The current future loses publication rights immediately, before the next flush.
Sourcepub fn cancel(self) -> Result<(), AccessError>
pub fn cancel(self) -> Result<(), AccessError>
Cancel immediately and become Idle. The same key stays idle until an explicit refresh; a subsequent source-key change starts a new request.
Trait Implementations§
Auto Trait Implementations§
impl<K, T, E> !RefUnwindSafe for Resource<K, T, E>
impl<K, T, E> !Send for Resource<K, T, E>
impl<K, T, E> !Sync for Resource<K, T, E>
impl<K, T, E> !UnwindSafe for Resource<K, T, E>
impl<K, T, E> Freeze for Resource<K, T, E>
impl<K, T, E> Unpin for Resource<K, T, E>
impl<K, T, E> UnsafeUnpin for Resource<K, T, E>
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