Struct windows_capture::monitor::Monitor

source ยท
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

source

pub fn primary() -> Result<Self, Error>

Returns the primary monitor.

ยงErrors

Returns an Error::NotFound if there is no primary monitor.

source

pub fn from_index(index: usize) -> Result<Self, Error>

Returns the monitor at the specified index.

ยงArguments
  • index - The index of the monitor to retrieve. The index starts from 1.
ยงErrors

Returns an Error::IndexIsLowerThanOne if the index is less than 1. Returns an Error::NotFound if the monitor at the specified index is not found.

source

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.

source

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.

source

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.

source

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.

source

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.

source

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.

source

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.

source

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.

source

pub const fn from_raw_hmonitor(monitor: isize) -> Self

Creates a Monitor instance from a raw HMONITOR.

ยงArguments
  • hmonitor - The raw HMONITOR.
source

pub const fn as_raw_hmonitor(&self) -> isize

Returns the raw HMONITOR of the monitor.

Trait Implementationsยง

sourceยง

impl Clone for Monitor

sourceยง

fn clone(&self) -> Monitor

Returns a copy of the value. Read more
1.0.0 ยท sourceยง

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. 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 PartialEq for Monitor

sourceยง

fn eq(&self, other: &Monitor) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 ยท sourceยง

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
sourceยง

impl TryFrom<Monitor> for GraphicsCaptureItem

ยง

type Error = Error

The type returned in the event of a conversion error.
sourceยง

fn try_from(value: Monitor) -> Result<Self, Self::Error>

Performs the conversion.
sourceยง

impl Copy for Monitor

sourceยง

impl Eq for Monitor

sourceยง

impl StructuralPartialEq for Monitor

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> IntoEither for T

sourceยง

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
sourceยง

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
sourceยง

impl<T> Pointable for T

sourceยง

const ALIGN: usize = _

The alignment of pointer.
ยง

type Init = T

The type for initializers.
sourceยง

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
sourceยง

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
sourceยง

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
sourceยง

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
sourceยง

impl<T> ToOwned for T
where T: Clone,

ยง

type Owned = T

The resulting type after obtaining ownership.
sourceยง

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
sourceยง

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
sourceยง

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

ยง

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>,

ยง

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.