Struct devicemapper::ThinDevWorkingStatus
source · pub struct ThinDevWorkingStatus {
pub nr_mapped_sectors: Sectors,
pub highest_mapped_sector: Option<Sectors>,
}Expand description
Status values for a thin device that is working
Fields§
§nr_mapped_sectors: SectorsThe number of mapped sectors
highest_mapped_sector: Option<Sectors>The highest mapped sector if any.
Implementations§
source§impl ThinDevWorkingStatus
impl ThinDevWorkingStatus
sourcepub fn new(
nr_mapped_sectors: Sectors,
highest_mapped_sector: Option<Sectors>
) -> ThinDevWorkingStatus
pub fn new(
nr_mapped_sectors: Sectors,
highest_mapped_sector: Option<Sectors>
) -> ThinDevWorkingStatus
Make a new ThinDevWorkingStatus struct
Examples found in repository?
src/thindev.rs (lines 240-242)
221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243
fn from_str(status_line: &str) -> DmResult<ThinStatus> {
if status_line.starts_with("Error") {
return Ok(ThinStatus::Error);
}
if status_line.starts_with("Fail") {
return Ok(ThinStatus::Fail);
}
let status_vals = get_status_line_fields(status_line, 2)?;
let count = Sectors(parse_value(status_vals[0], "sector count")?);
let highest = if count == Sectors(0) {
None
} else {
Some(Sectors(parse_value(status_vals[1], "highest used sector")?))
};
Ok(ThinStatus::Working(Box::new(ThinDevWorkingStatus::new(
count, highest,
))))
}Trait Implementations§
source§impl Clone for ThinDevWorkingStatus
impl Clone for ThinDevWorkingStatus
source§fn clone(&self) -> ThinDevWorkingStatus
fn clone(&self) -> ThinDevWorkingStatus
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read more