/// 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.
///
/// [`Lock`]: enum.Lock.html
Attempt to claim the desired [`Lock`] type using a byte range of a file.

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


Attempt to claim the desired [ ` Lock ` ] type using a byte range of a file . The byte range does not need to exist in the underlying file .
pub fn try_lock<T: Deref<Target = File>>(
    file: T,
    lock: Lock,
    offset: usize,
    len: usize,
) -> io::Result<FileGuard<T>> {
    unsafe {
        raw_file_lock(&file, Some(lock), offset, len, false)?;
    }
    Ok(FileGuard {
        offset,
        len,
        file,
        lock,
    })
}
pub fn try_lock < T : Deref < Target = File > > ( file : T , lock : Lock , offset : usize , len : usize , ) -> io :: Result < FileGuard < T > > { unsafe { raw_file_lock ( & file , Some ( lock ) , offset , len , false ) ? ; } Ok ( FileGuard { offset , len , file , lock , } ) }
Attempt to claim the desired [`Lock`] type using a byte range of a file.
Attempt to claim the desired [ ` Lock ` ] type using a byte range of a file .
file
T
lock
Lock
offset
usize
len
usize