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: Sectors

The number of mapped sectors

§highest_mapped_sector: Option<Sectors>

The highest mapped sector if any.

Implementations§

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§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. 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

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
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.