Skip to main content

Lock

Struct Lock 

Source
pub struct Lock { /* private fields */ }
Expand description

Locks a stable coordination inode, never a replaceable JSON document.

Implementations§

Source§

impl Lock

Source

pub fn acquire(path: &Path, shared: bool) -> Result<Lock, Problem>

Compatibility entry point; new callers can make the mode explicit.

Source

pub fn acquire_mode(path: &Path, mode: LockMode) -> Result<Lock, Problem>

Acquire the requested OS lock mode.

Source

pub fn read_existing(path: &Path) -> Result<Lock, Problem>

Shared admission on an existing gate, without creating files or requiring write access.

Source

pub fn wait_existing(path: &Path, mode: LockMode) -> Result<Lock, Problem>

Initializers can race to open the same freshly published gate. Wait for the winner to finish before comparing its layout with the requested one.

Source

pub async fn wait_existing_with_control( path: &Path, mode: LockMode, control: &Control, ) -> Result<Lock, Problem>

Wait for an existing lock while observing cancellation.

Source

pub async fn wait(path: &Path, control: &Control) -> Result<Lock, Problem>

Wait for admission to the requested lock.

Source

pub fn verify(&self) -> Result<(), Problem>

Check that the lock path still names the file held by this guard.

Trait Implementations§

Source§

impl Drop for Lock

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

Auto Trait Implementations§

§

impl Forget for Lock

§

impl Freeze for Lock

§

impl Move for Lock

§

impl RefUnwindSafe for Lock

§

impl Send for Lock

§

impl Sync for Lock

§

impl Unpin for Lock

§

impl UnsafeUnpin for Lock

§

impl UnwindSafe for Lock

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> 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> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.