ddc-enhanced-rs

Crates.ioddc-enhanced-rs
lib.rsddc-enhanced-rs
version1.2.7
sourcesrc
created_at2022-03-30 19:58:12.731122
updated_at2022-06-19 16:07:11.998416
descriptionDDC/CI high level library for Rust (cross platform)
homepagehttps://github.com/ThalusA/ddc-enhanced-rs#readme
repositoryhttps://github.com/ThalusA/ddc-enhanced-rs
max_upload_size
id559374
size20,854
ThalusA (ThalusA)

documentation

https://docs.rs/ddc-enhanced-rs

README

ddc-enhanced-rs

ddc-enhanced-rs is a cross platform Rust crate and Node package for controlling monitors with DDC/CI.

Documentation

Rust: https://docs.rs/ddc-enhanced-rs

NodeJS: https://github.com/ThalusA/ddc-enhanced-rs/blob/master/index.d.ts

Examples

Rust

use ddc_enhanced_rs::{get_enhanced_displays, get_brightness,
                      set_brightness, does_display_support_ddc};

// index in array is the id of the display
fn main() -> Result<(), std::io::Error> {
    for id in 0..get_enhanced_displays(false)?.len() {
        let value = get_brightness(id)?.value();
        set_brightness(id, value + 2).unwrap();
    }
    Ok(())
}

NodeJS

import Display from "ddc-enhanced-rs";

for (const display_info of Display.info()) {
    const display = new Display(display_info.id);
    const { value } = display.get_brightness();
    display.set_brightness(value + 2);
}
Commit count: 78

cargo fmt