Trait libmacchina::traits::ProductReadout [−][src]
pub trait ProductReadout { fn new() -> Self; fn version(&self) -> Result<String, ReadoutError> { ... } fn vendor(&self) -> Result<String, ReadoutError> { ... } fn family(&self) -> Result<String, ReadoutError> { ... } fn name(&self) -> Result<String, ReadoutError> { ... } fn product(&self) -> Result<String, ReadoutError> { ... } }
Expand description
This trait provides the interface for implementing functionality used for getting product information about the hosts operating system.
Example
use libmacchina::traits::ProductReadout; use libmacchina::traits::ReadoutError; pub struct MacOSProductReadout; impl ProductReadout for MacOSProductReadout { fn new() -> Self { MacOSProductReadout {} } fn vendor(&self) -> Result<String, ReadoutError> { Ok(String::from("Apple")) } fn family(&self) -> Result<String, ReadoutError> { Ok(String::from("Unix, Macintosh")) } fn name(&self) -> Result<String, ReadoutError> { // Get name of os release... Ok(String::from("Big Sur")) } fn product(&self) -> Result<String, ReadoutError> { Ok(String::from("macOS")) } }
Required methods
Provided methods
fn version(&self) -> Result<String, ReadoutError>
[src]
fn version(&self) -> Result<String, ReadoutError>
[src]This function should return the version of the host’s machine.
e.g. Lenovo IdeaPad S540-15IWL GTX
This is set by the machine’s manufacturer.
fn vendor(&self) -> Result<String, ReadoutError>
[src]
fn vendor(&self) -> Result<String, ReadoutError>
[src]This function should return the vendor name of the host’s machine.
e.g. Lenovo
This is set by the machine’s manufacturer.
fn family(&self) -> Result<String, ReadoutError>
[src]
fn family(&self) -> Result<String, ReadoutError>
[src]This function should return the family name of the host’s machine.
e.g. IdeaPad S540-15IWL GTX
This is set by the machine’s manufacturer.
fn name(&self) -> Result<String, ReadoutError>
[src]
fn name(&self) -> Result<String, ReadoutError>
[src]This function should return the name of the host’s machine.
e.g. 81SW
This is set by the machine’s manufacturer.
fn product(&self) -> Result<String, ReadoutError>
[src]
fn product(&self) -> Result<String, ReadoutError>
[src]This function should return the product name of the hosts machine.
e.g. IdeaPad S540-15IWL GTX
This is set by the machine’s manufacturer.