Struct Monitor

Source
pub struct Monitor { /* private fields */ }
Expand description

A handle to an attached monitor that allows the use of DDC/CI operations.

Implementations§

Source§

impl Monitor

Source

pub unsafe fn new(monitor: PHYSICAL_MONITOR) -> Self

Create a new monitor from the specified handle.

Source

pub fn enumerate() -> Result<Vec<Self>>

Enumerate all connected physical monitors.

Examples found in repository?
examples/enum.rs (line 8)
7fn main() {
8    let monitors = Monitor::enumerate().unwrap();
9    for mut m in monitors {
10        print!("{:?}: ", m);
11        println!("{:?}", m.get_timing_report());
12    }
13}
Source

pub fn description(&self) -> String

Physical monitor description string.

Source

pub fn handle(&self) -> HANDLE

Physical monitor winapi handle.

Source

pub fn winapi_get_timing_report(&self) -> Result<MC_TIMING_REPORT>

Retrieves a monitor’s horizontal and vertical synchronization frequencies.

Source

pub fn winapi_set_vcp_feature(&self, code: BYTE, value: DWORD) -> Result<()>

Sets the value of a Virtual Control Panel (VCP) code for a monitor.

Source

pub fn winapi_save_current_settings(&self) -> Result<()>

Saves the current monitor settings to the display’s nonvolatile storage.

Source

pub fn winapi_get_vcp_feature_and_vcp_feature_reply( &self, code: BYTE, ) -> Result<(MC_VCP_CODE_TYPE, DWORD, DWORD)>

Retrieves the current value, maximum value, and code type of a Virtual Control Panel (VCP) code for a monitor.

Returns (vcp_type, current_value, max_value)

Source

pub fn winapi_get_capabilities_string_length(&self) -> Result<DWORD>

Retrieves the length of the buffer to pass to winapi_capabilities_request_and_capabilities_reply.

Source

pub fn winapi_capabilities_request_and_capabilities_reply( &self, string: &mut [u8], ) -> Result<()>

Retrieves a string describing a monitor’s capabilities.

This string is always ASCII and includes a terminating null character.

Trait Implementations§

Source§

impl Ddc for Monitor

Source§

fn capabilities_string(&mut self) -> Result<Vec<u8>, Self::Error>

Retrieve the capability string from the device. Read more
Source§

fn get_vcp_feature( &mut self, code: FeatureCode, ) -> Result<VcpValue, Self::Error>

Gets the current value of an MCCS VCP feature.
Source§

fn set_vcp_feature( &mut self, code: FeatureCode, value: u16, ) -> Result<(), Self::Error>

Sets a VCP feature to the specified value.
Source§

fn save_current_settings(&mut self) -> Result<(), Self::Error>

Instructs the device to save its current settings.
Source§

fn get_timing_report(&mut self) -> Result<TimingMessage, Self::Error>

Retrieves a timing report from the device.
Source§

impl DdcHost for Monitor

Source§

type Error = Error

An error that can occur when communicating with a DDC device. Read more
Source§

fn sleep(&mut self)

Wait for any previous commands to complete. Read more
Source§

impl Debug for Monitor

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Drop for Monitor

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.