Function file_guard::try_lock[][src]

pub fn try_lock<T: Deref<Target = File>>(
    file: T,
    lock: Lock,
    offset: usize,
    len: usize
) -> Result<FileGuard<T>>
Expand description

Attempt to claim the desired Lock type using a byte range of a file.

If the desired Lock type cannot be obtained without blocking, an Error of kind ErrorKind::WouldBlock is returned. Otherwise if successful, the lock is held.

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