Struct file_guard::FileGuard[][src]

pub struct FileGuard<T: Deref<Target = File>> { /* fields omitted */ }
Expand description

An RAII implementation of a “scoped lock” of a file. When this structure is dropped (falls out of scope), the lock will be unlocked.

This structure is created by the lock(), try_lock(), and lock_any() functions.

Implementations

Gets the Lock type currently held.

Test if the currently held Lock type is Shared.

Test if the currently held Lock type is Exclusive.

Gets the byte range of the held lock.

Gets the byte offset of the held lock.

Gets the byte length of the held lock.

Tests if the byte range of the lock has a length of zero.

Safely exchanges an Exclusive Lock for a Shared one.

If the currently held lock is already Shared, no change is made and the method succeeds. This exchange safely ensures no lock is released during operation. That is, no waiting Exclusive lock attempts may obtain the lock during the downgrade. Other Shared locks waiting will be granted a lock as a result, however.

Trait Implementations

Formats the value using the given formatter. Read more

The resulting type after dereferencing.

Dereferences the value.

Executes the destructor for this type. Read more

Upgrades a lock from Shared to Exclusive. Read more

Attempts to upgrade a lock from Shared to Exclusive. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.