Struct devicemapper::DmOptions[][src]

pub struct DmOptions { /* fields omitted */ }
Expand description

Encapsulates options for device mapper calls

Implementations

Create a new empty option

Set the DmFlags value for option. Note this call is not additive in that it sets (replaces) entire flag value in one call. Thus if you want to incrementally add additional flags you need to retrieve current and ‘|’ with new.

use devicemapper::DmFlags;
use devicemapper::DmOptions;

let mut options = DmOptions::new();
options.set_flags(DmFlags::DM_READONLY);
let flags = DmFlags::DM_PERSISTENT_DEV | options.flags();
options.set_flags(flags);

Set the cookie bitfield value for option (overloaded meaning with event_nr in header). Note this call is not additive in that it sets (replaces) entire cookie value in one call. Thus if you want to incrementally add additional flags you need to retrieve current and ‘|’ with new.

use devicemapper::{DmCookie, DmFlags};
use devicemapper::DmOptions;

let mut options = DmOptions::new();
options.set_cookie(DmCookie::DM_UDEV_PRIMARY_SOURCE_FLAG);

let new_cookie = options.cookie() | DmCookie::DM_UDEV_DISABLE_DM_RULES_FLAG;
options.set_cookie(new_cookie);

Retrieve the flags value

Retrieve the cookie value (used for input in upper 16 bits of event_nr header field).

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns the “default value” for a type. 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 resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

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.