Trait Brightness

Source
pub trait Brightness: SysClass {
    // Provided methods
    fn brightness(&self) -> Result<u64> { ... }
    fn max_brightness(&self) -> Result<u64> { ... }
    fn set_brightness(&self, input: u64) -> Result<()> { ... }
    fn set_if_lower_than(&self, percent: u64) -> Result<()> { ... }
}

Provided Methods§

Source

fn brightness(&self) -> Result<u64>

Examples found in repository?
examples/leds.rs (line 9)
4fn main() -> io::Result<()> {
5    for dev in Leds::all()? {
6        println!(
7            "{} brightness: {} / {}",
8            dev.id(),
9            dev.brightness().unwrap(),
10            dev.max_brightness().unwrap()
11        );
12    }
13
14    Ok(())
15}
More examples
Hide additional examples
examples/backlight.rs (line 9)
4fn main() -> io::Result<()> {
5    for dev in Backlight::all()? {
6        println!(
7            "{} brightness: {} / {}",
8            dev.id(),
9            dev.brightness().unwrap(),
10            dev.max_brightness().unwrap()
11        );
12    }
13
14    Ok(())
15}
Source

fn max_brightness(&self) -> Result<u64>

Examples found in repository?
examples/leds.rs (line 10)
4fn main() -> io::Result<()> {
5    for dev in Leds::all()? {
6        println!(
7            "{} brightness: {} / {}",
8            dev.id(),
9            dev.brightness().unwrap(),
10            dev.max_brightness().unwrap()
11        );
12    }
13
14    Ok(())
15}
More examples
Hide additional examples
examples/backlight.rs (line 10)
4fn main() -> io::Result<()> {
5    for dev in Backlight::all()? {
6        println!(
7            "{} brightness: {} / {}",
8            dev.id(),
9            dev.brightness().unwrap(),
10            dev.max_brightness().unwrap()
11        );
12    }
13
14    Ok(())
15}
Source

fn set_brightness(&self, input: u64) -> Result<()>

Source

fn set_if_lower_than(&self, percent: u64) -> Result<()>

Sets the new brightness level if it is less than the current brightness.

Returns the brightness level that was set at the time of exiting the function.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§