pub struct BlockDevice {
pub name: String,
pub maj_min: String,
pub rm: bool,
pub size: String,
pub ro: bool,
pub device_type: String,
pub mountpoints: Vec<Option<String>>,
pub children: Option<Vec<BlockDevice>>,
}Expand description
Represents a block device as output by lsblk.
Note that the children field is optional, as some devices might not have any nested children.
§Field Details
name: The device name.maj_min: The device’s major and minor numbers. (Renamed from the JSON field “maj:min”)rm: Whether the device is removable.size: The device size.ro: Whether the device is read-only.device_type: The device type (renamed from the reserved keyword “type”).mountpoints: A vector of mountpoints for the device. Uses a custom deserializer to support both single and multiple mountpoints.children: Optional nested block devices.
Fields§
§name: StringThe name of the block device.
maj_min: StringThe major and minor numbers of the block device.
This field corresponds to the JSON field "maj:min".
rm: boolIndicates if the device is removable.
size: StringThe size of the block device.
ro: boolIndicates if the device is read-only.
device_type: StringThe type of the block device.
The JSON field is "type", which is a reserved keyword in Rust. It is renamed to device_type.
mountpoints: Vec<Option<String>>The mountpoints of the device.
Uses a custom deserializer to handle both a single mountpoint (possibly null) and an array of mountpoints.
children: Option<Vec<BlockDevice>>Optional nested children block devices.
Implementations§
Trait Implementations§
Source§impl Debug for BlockDevice
impl Debug for BlockDevice
Source§impl<'de> Deserialize<'de> for BlockDevice
impl<'de> Deserialize<'de> for BlockDevice
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for BlockDevice
impl RefUnwindSafe for BlockDevice
impl Send for BlockDevice
impl Sync for BlockDevice
impl Unpin for BlockDevice
impl UnwindSafe for BlockDevice
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