Skip to main content

SmartAttribute

Struct SmartAttribute 

Source
pub struct SmartAttribute {
    pub id: u8,
    pub name: String,
    pub flags: u16,
    pub normalized: i32,
    pub worst: i32,
    pub threshold: i32,
    pub pretty: Option<PrettyValue>,
}
Expand description

A S.M.A.R.T. attribute.

Fields§

§id: u8

Attribute Identifier

§name: String

The identifier as a string.

§flags: u16

16-bit attribute flags (bit 0 is prefail/oldage, bit 1 is online/offline).

§normalized: i32

The current value or -1 if unknown.

§worst: i32

The worst value of -1 if unknown.

§threshold: i32

The threshold or -1 if unknown.

§pretty: Option<PrettyValue>

An interpretation of the value

Implementations§

Source§

impl SmartAttribute

Source

pub fn pre_fail(&self) -> bool

Whether this attribute determines if the drive is failing (true) or old (false).

From SFF 8035i Revision 2 page 19:

Bit 0 (pre-failure/advisory bit) - If the value of this bit equals zero, an attribute value less than or equal to its corresponding attribute threshold indicates an advisory condition where the usage or age of the device has exceeded its intended design life period. If the value of this bit equals one, an attribute value less than or equal to its corresponding attribute threshold indicates a prefailure condition where imminent loss of data is being predicted.


From SMART Attribute Overview:

0: Advisory: The usage of age of the device has exceeded its intended design life period
1: Pre-failure notification: Failure is predicted within 24 hours

Source

pub fn online(&self) -> bool

From SFF 8035i Revision 2 page 19:

Bit 1 (on-line data collection bit) - If the value of this bit equals zero, then the attribute value is updated only during off-line data collection activities. If the value of this bit equals one, then the attribute value is updated during normal operation of the device or during both normal operation and off-line testing.

Source

pub fn performance(&self) -> bool

true: speed/performance

Source

pub fn error_rate(&self) -> bool

Source

pub fn event_count(&self) -> bool

Source

pub fn self_preserving(&self) -> bool

Source

pub fn assessment(&self) -> SmartAssessment

Assess the disk’s state.

From https://github.com/GNOME/gnome-disk-utility/blob/5baa52eff3036fc59648bc2e10c4d4ec69dec50b/src/disks/gduatasmartdialog.c#L678

Trait Implementations§

Source§

impl Clone for SmartAttribute

Source§

fn clone(&self) -> SmartAttribute

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for SmartAttribute

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl From<(u8, String, u16, i32, i32, i32, i64, i32, HashMap<String, Variant<Box<dyn RefArg>>>)> for SmartAttribute

Source§

fn from( (id, name, flags, value, worst, threshold, pretty_value, pretty_unit, _expansion): (u8, String, u16, i32, i32, i32, i64, i32, HashMap<String, Variant<Box<dyn RefArg>>>), ) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

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

fn clone_into(&self, target: &mut T)

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

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.