Skip to main content

FlockOperations

Trait FlockOperations 

Source
pub trait FlockOperations {
    // Required methods
    fn default() -> Self;
    fn with_l_type(self, l_type: c_short) -> Self;
    fn with_locktype(self, locktype: FcntlLockType) -> Self;
}
Expand description

This trait is used to define functions wich directly operate on flock.

use libc::flock;
use fcntl::{FcntlLockType, FlockOperations};

let flock = flock::default().with_locktype(FcntlLockType::Write);

Required Methods§

Source

fn default() -> Self

Since we don’t have control over libc::flock we cannot impl Default for libc::flock

Source

fn with_l_type(self, l_type: c_short) -> Self

Sets l_type to the given value using the builder pattern. This is mostly intended for internal use. Where possible, it is recommended to use other methods which alter l_type (e.g. with_locktype).

Source

fn with_locktype(self, locktype: FcntlLockType) -> Self

Sets the lock type (l_type) to the appropriate value for the given FcntlLockType, using the builder pattern.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§