pub struct ResourceFree<S: Subject> { /* private fields */ }
Expand description
An unlocked/free resource.
Implementations§
Source§impl<S: Subject> ResourceFree<S>
impl<S: Subject> ResourceFree<S>
pub fn new(lock: UnlockedFile, inner: S) -> Self
Attempt to obtain a shared lock on the resource.
Obtain a shared lock on the resource. Can block indefinitely.
Sourcepub fn try_exclusive(
self,
) -> Result<Either<Self, ResourceExclusive<S>>, CoordinateError<S::Error>>
pub fn try_exclusive( self, ) -> Result<Either<Self, ResourceExclusive<S>>, CoordinateError<S::Error>>
Attempt to obtain an exclusive lock on the resource.
Sourcepub fn exclusive(
self,
) -> Result<ResourceExclusive<S>, CoordinateError<S::Error>>
pub fn exclusive( self, ) -> Result<ResourceExclusive<S>, CoordinateError<S::Error>>
Obtain an exclusive lock on the resource. Can block indefinitely.
Sourcepub fn into_parts(self) -> (UnlockedFile, S)
pub fn into_parts(self) -> (UnlockedFile, S)
Disassembles this resource into the lock and the inner, managed, value. This can only be done from an unlocked/free resource.
Source§impl<S: Subject + FacetFree> ResourceFree<S>
impl<S: Subject + FacetFree> ResourceFree<S>
Sourcepub fn facet(&self) -> S::FacetFree<'_>
pub fn facet(&self) -> S::FacetFree<'_>
Return the FacetFree::FacetFree
of the wrapped resource.
Auto Trait Implementations§
impl<S> Freeze for ResourceFree<S>where
S: Freeze,
impl<S> RefUnwindSafe for ResourceFree<S>where
S: RefUnwindSafe,
impl<S> Send for ResourceFree<S>where
S: Send,
impl<S> Sync for ResourceFree<S>where
S: Sync,
impl<S> Unpin for ResourceFree<S>where
S: Unpin,
impl<S> UnwindSafe for ResourceFree<S>where
S: UnwindSafe,
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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