Struct Flock
pub struct Flock<T: Flockable>(/* private field */);
Represents an owned flock, which unlocks on drop.
See flock(2) for details on locking semantics.
Implementations
impl<T: Flockable> Flock<T>
fn lock(t: T, args: FlockArg) -> Result<Self, (T, Errno)>Obtain a/an flock.
Example
# use Write; # use File; # use ; #fn unlock(self) -> Result<T, (Self, Errno)>Remove the lock and return the object wrapped within.
Example
# use File; # use ;fn relock(&self, arg: FlockArg) -> Result<()>Relock the file. This can upgrade or downgrade the lock type.
Example
# use File; # use ; # use tempfile; let f: File = tempfile.unwrap; let locked_file = lock.unwrap; // Do stuff, then downgrade the lock locked_file.relock.unwrap;
Trait Implementations
impl<T: Debug + Flockable> Debug for Flock<T>
fn fmt(&self, f: &mut Formatter<'_>) -> Result
impl<T: Flockable> Deref for Flock<T>
type Target = T;fn deref(&self) -> &Self::Target
impl<T: Flockable> DerefMut for Flock<T>
fn deref_mut(&mut self) -> &mut Self::Target
impl<T: Flockable> Drop for Flock<T>
fn drop(&mut self)
Auto Trait Implementations
impl<T> Freeze for Flock<T>
where
T: Freeze,
impl<T> RefUnwindSafe for Flock<T>
where
T: RefUnwindSafe,
impl<T> Send for Flock<T>
where
T: Send,
impl<T> Sync for Flock<T>
where
T: Sync,
impl<T> Unpin for Flock<T>
where
T: Unpin,
impl<T> UnsafeUnpin for Flock<T>
where
T: UnsafeUnpin,
impl<T> UnwindSafe for Flock<T>
where
T: UnwindSafe,
Blanket Implementations
impl<P, T> Receiver for Flock<T>
where
P: Deref<Target = T> + ?Sized,
T: ?Sized,
type Target = T;
impl<T> Any for Flock<T>
where
T: 'static + ?Sized,
fn type_id(&self) -> TypeId
impl<T> Borrow<T> for Flock<T>
where
T: ?Sized,
fn borrow(&self) -> &T
impl<T> BorrowMut<T> for Flock<T>
where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
impl<T> From<T> for Flock<T>
fn from(t: T) -> TReturns the argument unchanged.
impl<T, U> Into<U> for Flock<T>
where
U: From<T>,
fn into(self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom<U> for Flock<T>
where
U: Into<T>,
type Error = never;fn try_from(value: U) -> Result<T, never>
impl<T, U> TryInto<U> for Flock<T>
where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error;fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>