pub struct Monitor { /* private fields */ }
Expand description
Represents a display monitor.
§Examples
let mut monitors = Monitor::enumerate();
monitors[0].set_input_source(InputSource::UsbC1.as_raw());
Implementations§
Source§impl Monitor
impl Monitor
Sourcepub fn new(ddc_hi_display: Display) -> Self
pub fn new(ddc_hi_display: Display) -> Self
Create an instance from ddc_hi::Display
.
Sourcepub fn enumerate() -> Vec<Self>
pub fn enumerate() -> Vec<Self>
Enumerate all display monitors.
See also ddc_hi::Display::enumerate()
.
Sourcepub fn set_dry_run(value: bool)
pub fn set_dry_run(value: bool)
Set the dry-run mode. When in dry-run mode, functions that are supposed to make changes don’t actually make the changes.
Sourcepub fn update_capabilities(&mut self) -> Result<()>
pub fn update_capabilities(&mut self) -> Result<()>
Updates the display info with data retrieved from the device’s
reported capabilities.
See also ddc_hi::Display::update_capabilities()
.
Sourcepub fn input_source(&mut self) -> Result<InputSourceRaw>
pub fn input_source(&mut self) -> Result<InputSourceRaw>
Get the current input source.
§Examples
print!("{}", InputSource::str_from_raw(monitor.input_source()?));
Sourcepub fn set_input_source(&mut self, value: InputSourceRaw) -> Result<()>
pub fn set_input_source(&mut self, value: InputSourceRaw) -> Result<()>
Set the current input source.
§Examples
fn set_to_usbc1(monitor: &mut Monitor) -> anyhow::Result<()> {
monitor.set_input_source(InputSource::UsbC1.as_raw())
}
fn set_to(monitor: &mut Monitor, input_source_str: &str) -> anyhow::Result<()> {
monitor.set_input_source(InputSource::raw_from_str(input_source_str)?)
}
Sourcepub fn input_sources(&mut self) -> Option<Vec<InputSourceRaw>>
pub fn input_sources(&mut self) -> Option<Vec<InputSourceRaw>>
Get all input sources.
Requires to call Monitor::update_capabilities()
beforehand.
Sourcepub fn sleep_if_needed(&mut self)
pub fn sleep_if_needed(&mut self)
Sleep if any previous DDC commands need time to be executed.
See also ddc_hi::DdcHost::sleep()
.
Sourcepub fn to_long_string(&mut self) -> String
pub fn to_long_string(&mut self) -> String
Get a multi-line descriptive string.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Monitor
impl RefUnwindSafe for Monitor
impl Send for Monitor
impl Sync for Monitor
impl Unpin for Monitor
impl UnwindSafe for Monitor
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more