Function file_guard::lock_any

source ·
pub fn lock_any<T: Deref<Target = File>>(
    file: T,
    offset: usize,
    len: usize
) -> Result<FileGuard<T>>
Expand description

First attempt to claim an Exclusive lock and then fallback to a Shared lock for a byte range of a file. This is not currently an atomic operation.

When successful, the FileGuard may be inspected for the lock type obtained using .lock_type(), .is_shared(), or .is_exclusive().

The byte range does not need to exist in the underlying file.