pub struct Access {
pub device_type: DeviceType,
pub device_number: Device,
pub access_type: AccessType,
}Expand description
Access to devices of specific type and number.
Access implements FromStr and Display. You can convert a Access into a string and
vice versa. parse returns an error with kind ErrorKind::Parse if failed.
use controlgroup::{Device, DeviceNumber, v1::devices::{Access, AccessType, DeviceType}};
let access = "c 1:3 mr".parse::<Access>().unwrap();
assert_eq!(
access,
Access {
device_type: DeviceType::Char,
device_number: [1, 3].into(),
access_type: AccessType { read: true, write: false, mknod: true },
}
);
let access = "a *:* rwm".parse::<Access>().unwrap();
assert_eq!(
access,
Access {
device_type: DeviceType::All,
device_number: Device { major: DeviceNumber::Any, minor: DeviceNumber::Any },
access_type: AccessType { read: true, write: true, mknod: true },
}
);
let access = "a".parse::<Access>().unwrap(); // equivalent to "a *:* rwm"
assert_eq!(
access,
Access {
device_type: DeviceType::All,
device_number: Device { major: DeviceNumber::Any, minor: DeviceNumber::Any },
access_type: AccessType { read: true, write: true, mknod: true },
}
);use controlgroup::{Device, DeviceNumber, v1::devices::{Access, AccessType, DeviceType}};
let access = Access {
device_type: DeviceType::Char,
device_number: Device { major: DeviceNumber::Number(1), minor: DeviceNumber::Number(3) },
access_type: AccessType { read: true, write: false, mknod: true },
};
assert_eq!(access.to_string(), "c 1:3 rm");
let access = Access {
device_type: DeviceType::All,
device_number: Device { major: DeviceNumber::Any, minor: DeviceNumber::Any },
access_type: AccessType { read: true, write: true, mknod: true },
};
assert_eq!(access.to_string(), "a *:* rwm");Fields§
§device_type: DeviceTypeType of device for which access is permitted or denied.
device_number: DeviceNumber of device for which access is permitted or denied.
access_type: AccessTypeWhat kinds of access is permitted or denied.
Trait Implementations§
impl Eq for Access
impl StructuralPartialEq for Access
Auto Trait Implementations§
impl Freeze for Access
impl RefUnwindSafe for Access
impl Send for Access
impl Sync for Access
impl Unpin for Access
impl UnsafeUnpin for Access
impl UnwindSafe for Access
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more