[][src]Struct rust_lcd::Device

pub struct Device { /* fields omitted */ }

A single backlight device that can be toggled ON and OFF.

Examples

use std::path::Path;
let path = Path::new("/sys/class/backlight/intel_backlight");
let dev = Device::new(path);
assert_eq!(dev.bl_power(), path.join(BL_POWER));
assert!(dev.toggle().is_err()); // we don't have permission

Methods

impl Device[src]

pub fn new<P: AsRef<Path>>(path: P) -> Self[src]

Creates a new device located at path.

pub fn path(&self) -> &Path[src]

Returns the path of the device.

pub fn bl_power(&self) -> &Path[src]

Returns the path of the device power controller.

pub fn toggle(&self) -> Result<i32>[src]

Toggles the state of the device ON and OFF.

The return value is either a std::io::Error or the new state of the device.

Trait Implementations

impl Debug for Device[src]

Auto Trait Implementations

impl Send for Device

impl Unpin for Device

impl Sync for Device

impl UnwindSafe for Device

impl RefUnwindSafe for Device

Blanket Implementations

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]