pub struct Monitor { /* private fields */ }Expand description
Represents A Monitor Device
ยงExample
use windows_capture::monitor::Monitor;
fn main() -> Result<(), Box<dyn std::error::Error>> {
let monitor = Monitor::primary()?;
println!("Primary Monitor: {}", monitor.name()?);
Ok(())
}Implementationsยง
Sourceยงimpl Monitor
impl Monitor
Sourcepub fn from_index(index: usize) -> Result<Self, Error>
pub fn from_index(index: usize) -> Result<Self, Error>
Sourcepub fn index(&self) -> Result<usize, Error>
pub fn index(&self) -> Result<usize, Error>
Returns the index of the monitor.
ยงErrors
Returns an Error if there is an error retrieving the monitor index.
Sourcepub fn name(&self) -> Result<String, Error>
pub fn name(&self) -> Result<String, Error>
Returns the name of the monitor.
ยงErrors
Returns an Error if there is an error retrieving the monitor name.
Sourcepub fn device_name(&self) -> Result<String, Error>
pub fn device_name(&self) -> Result<String, Error>
Returns the device name of the monitor.
ยงErrors
Returns an Error if there is an error retrieving the monitor device name.
Sourcepub fn device_string(&self) -> Result<String, Error>
pub fn device_string(&self) -> Result<String, Error>
Returns the device string of the monitor.
ยงErrors
Returns an Error if there is an error retrieving the monitor device string.
Sourcepub fn refresh_rate(&self) -> Result<u32, Error>
pub fn refresh_rate(&self) -> Result<u32, Error>
Returns the refresh rate of the monitor in hertz.
ยงErrors
Returns an Error if there is an error retrieving the monitor refresh rate.
Sourcepub fn width(&self) -> Result<u32, Error>
pub fn width(&self) -> Result<u32, Error>
Returns the width of the monitor in pixels.
ยงErrors
Returns an Error if there is an error retrieving the monitor width.
Sourcepub fn height(&self) -> Result<u32, Error>
pub fn height(&self) -> Result<u32, Error>
Returns the height of the monitor in pixels.
ยงErrors
Returns an Error if there is an error retrieving the monitor height.
Sourcepub fn enumerate() -> Result<Vec<Self>, Error>
pub fn enumerate() -> Result<Vec<Self>, Error>
Returns a list of all monitors.
ยงErrors
Returns an Error if there is an error enumerating the monitors.
Sourcepub const fn from_raw_hmonitor(monitor: *mut c_void) -> Self
pub const fn from_raw_hmonitor(monitor: *mut c_void) -> Self
Sourcepub const fn as_raw_hmonitor(&self) -> *mut c_void
pub const fn as_raw_hmonitor(&self) -> *mut c_void
Returns the raw HMONITOR of the monitor.
Trait Implementationsยง
impl Copy for Monitor
impl Eq for Monitor
impl Send for Monitor
impl StructuralPartialEq for Monitor
Auto Trait Implementationsยง
impl Freeze for Monitor
impl RefUnwindSafe 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
Sourceยงimpl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Sourceยงimpl<T> IntoEither for T
impl<T> IntoEither for T
Sourceยงfn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSourceยงfn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more