xrandr_parser::connector

Struct Connector

Source
pub struct Connector {
    pub name: String,
    pub status: String,
    pub primary: bool,
    pub current_resolution: Resolution,
    pub current_refresh_rate: String,
    pub prefered_resolution: Resolution,
    pub prefered_refresh_rate: String,
    pub position: Position,
    pub orientation: String,
    pub available_orientations: Vec<String>,
    pub physical_dimensions: Dimensions,
    pub output_info: Vec<Output>,
}

Fields§

§name: String§status: String§primary: bool§current_resolution: Resolution§current_refresh_rate: String§prefered_resolution: Resolution§prefered_refresh_rate: String§position: Position§orientation: String§available_orientations: Vec<String>§physical_dimensions: Dimensions§output_info: Vec<Output>

Implementations§

Source§

impl Connector

Source

pub fn set_name(&mut self, value: String) -> &mut Self

Sets the name field of this struct.

Source

pub fn set_status(&mut self, value: String) -> &mut Self

Sets the status field of this struct.

Source

pub fn set_primary(&mut self, value: bool) -> &mut Self

Sets the primary field of this struct.

Source

pub fn set_current_resolution(&mut self, value: Resolution) -> &mut Self

Sets the current_resolution field of this struct.

Source

pub fn set_current_refresh_rate(&mut self, value: String) -> &mut Self

Sets the current_refresh_rate field of this struct.

Source

pub fn set_prefered_resolution(&mut self, value: Resolution) -> &mut Self

Sets the prefered_resolution field of this struct.

Source

pub fn set_prefered_refresh_rate(&mut self, value: String) -> &mut Self

Sets the prefered_refresh_rate field of this struct.

Source

pub fn set_position(&mut self, value: Position) -> &mut Self

Sets the position field of this struct.

Source

pub fn set_orientation(&mut self, value: String) -> &mut Self

Sets the orientation field of this struct.

Source

pub fn set_available_orientations(&mut self, value: Vec<String>) -> &mut Self

Sets the available_orientations field of this struct.

Source

pub fn set_physical_dimensions(&mut self, value: Dimensions) -> &mut Self

Sets the physical_dimensions field of this struct.

Source

pub fn set_output_info(&mut self, value: Vec<Output>) -> &mut Self

Sets the output_info field of this struct.

Source§

impl Connector

Source

pub fn new() -> Self

Create a new instance of Connector

Source

pub fn name(&self) -> String

Getter function for Connector.name

§Example
#[allow(non_snake_case)]

use xrandr_parser::Parser;

fn main() -> Result<(), String> {
    let mut XrandrParser = Parser::new();

    XrandrParser.parse()?;

    let connector = &XrandrParser.get_connector("HDMI-1")?;

    let name = &connector.name();

    println!("Connector name: {}", name);

    Ok(())
}
Source

pub fn status(&self) -> String

Getter function for Connector.status

§Example
#[allow(non_snake_case)]

use xrandr_parser::Parser;

fn main() -> Result<(), String> {
    let mut XrandrParser = Parser::new();

    XrandrParser.parse()?;

    let connector = &XrandrParser.get_connector("HDMI-1")?;

    let status = &connector.status();

    println!("Connector status: {}", status);

    Ok(())
}
Source

pub fn primary(&self) -> bool

Getter function for Connector.primary

§Example
#[allow(non_snake_case)]

use xrandr_parser::Parser;

fn main() -> Result<(), String> {
    let mut XrandrParser = Parser::new();

    XrandrParser.parse()?;

    let connector = &XrandrParser.get_connector("HDMI-1")?;

    let primary = &connector.primary();

    println!("Connector primary: {}", primary);

    Ok(())
}
Source

pub fn current_resolution(&self) -> Resolution

Getter function for Connector.current_resolution

§Example
#[allow(non_snake_case)]

use xrandr_parser::Parser;

fn main() -> Result<(), String> {
    let mut XrandrParser = Parser::new();

    XrandrParser.parse()?;

    let connector = &XrandrParser.get_connector("HDMI-1")?;

    let current_resolution = &connector.current_resolution();

    println!("Connector Current Resolution: {:#?}", current_resolution);

    Ok(())
}
Source

pub fn current_refresh_rate(&self) -> String

Getter function for Connector.current_refresh_rate

§Example
#[allow(non_snake_case)]

use xrandr_parser::Parser;

fn main() -> Result<(), String> {
    let mut XrandrParser = Parser::new();

    XrandrParser.parse()?;

    let connector = &XrandrParser.get_connector("HDMI-1")?;

    let current_refresh_rate = &connector.current_refresh_rate();

    println!("Connector Current Refresh Rate: {}", current_refresh_rate);

    Ok(())
}
Source

pub fn prefered_resolution(&self) -> Resolution

Getter function for Connector.prefered_resolution

§Example
#[allow(non_snake_case)]

use xrandr_parser::Parser;

fn main() -> Result<(), String> {
    let mut XrandrParser = Parser::new();

    XrandrParser.parse()?;

    let connector = &XrandrParser.get_connector("HDMI-1")?;

    let prefered_resolution = &connector.prefered_resolution();

    println!("Connector Prefered Resolution: {:#?}", prefered_resolution);

    Ok(())
}
Source

pub fn prefered_refresh_rate(&self) -> String

Getter function for Connector.prefered_refresh_rate

§Example
#[allow(non_snake_case)]

use xrandr_parser::Parser;

fn main() -> Result<(), String> {
    let mut XrandrParser = Parser::new();

    XrandrParser.parse()?;

    let connector = &XrandrParser.get_connector("HDMI-1")?;

    let prefered_refresh_rate = &connector.prefered_refresh_rate();

    println!("Connector Prefered Refresh Rate: {}", prefered_refresh_rate);

    Ok(())
}
Source

pub fn position(&self) -> Position

Getter function for Connector.primary

§Example
#[allow(non_snake_case)]

use xrandr_parser::Parser;

fn main() -> Result<(), String> {
    let mut XrandrParser = Parser::new();

    XrandrParser.parse()?;

    let connector = &XrandrParser.get_connector("HDMI-1")?;

    let position = &connector.position();

    println!("Connector position: {:#?}", position);

    Ok(())
}
Source

pub fn orientation(&self) -> String

Getter function for Connector.orientation

§Example
#[allow(non_snake_case)]

use xrandr_parser::Parser;

fn main() -> Result<(), String> {
    let mut XrandrParser = Parser::new();

    XrandrParser.parse()?;

    let connector = &XrandrParser.get_connector("HDMI-1")?;

    let orientation = &connector.orientation();

    println!("Connector orientation: {}", orientation);

    Ok(())
}
Source

pub fn available_orientations(&self) -> Vec<String>

Getter function for Connector.available_orientations

§Example
#[allow(non_snake_case)]

use xrandr_parser::Parser;

fn main() -> Result<(), String> {
    let mut XrandrParser = Parser::new();

    XrandrParser.parse()?;

    let connector = &XrandrParser.get_connector("HDMI-1")?;

    let available_orientations = &connector.available_orientations();

    println!("Connector Available Orientations: {:#?}", available_orientations);

    Ok(())
}
Source

pub fn physical_dimensions(&self) -> Dimensions

Getter function for Connector.physical_dimensions

§Example
#[allow(non_snake_case)]

use xrandr_parser::Parser;

fn main() -> Result<(), String> {
    let mut XrandrParser = Parser::new();

    XrandrParser.parse()?;

    let connector = &XrandrParser.get_connector("HDMI-1")?;

    let physical_dimensions = &connector.physical_dimensions();

    println!("Connector Physical Dimensions: {:#?}", physical_dimensions);

    Ok(())
}
Source

pub fn output_info(&self) -> Vec<Output>

Getter function for Connector.output_info

§Example
#[allow(non_snake_case)]

use xrandr_parser::Parser;

fn main() -> Result<(), String> {
    let mut XrandrParser = Parser::new();

    XrandrParser.parse()?;

    let connector = &XrandrParser.get_connector("HDMI-1")?;

    let output_info = &connector.output_info();

    println!("Connector Output Info: {:#?}", output_info);

    Ok(())
}
Source

pub fn available_resolutions(&self) -> Result<Vec<Resolution>, String>

Get available resolutions for a specific connector in struct form. If the resolution is not found it returns an empty Vec<Resolution> not an error.

§Example
#[allow(non_snake_case)]

use xrandr_parser::Parser;

fn main() -> Result<(), String> {
    let mut XrandrParser = Parser::new();

    XrandrParser.parse()?;

    let connector = &XrandrParser.get_connector("HDMI-1")?;

    let available_resolutions = &connector.available_resolutions()?;

    println!("Available Resolutions: {:#?}", available_resolutions);

    Ok(())
}
Source

pub fn available_resolutions_pretty(&self) -> Result<Vec<String>, String>

Get available resolutions for a specific connector in String form. If the resolution is not found it returns an empty Vec<String> not an error.

#[allow(non_snake_case)]

use xrandr_parser::Parser;

fn main() -> Result<(), String> {
    let mut XrandrParser = Parser::new();

    XrandrParser.parse()?;

    let connector = &XrandrParser.get_connector("HDMI-1")?;

    let available_resolutions = &connector.available_resolutions_pretty()?;

    println!("Available Resolutions: {:#?}", available_resolutions);

    Ok(())
}
Source

pub fn available_refresh_rates( &self, target_resolution: &str, ) -> Result<Vec<String>, String>

Get available refresh rates for a specific connector at a given resolution. If the resolution is not found it returns an empty Vec<String> not an error.

§Example
#[allow(non_snake_case)]

use xrandr_parser::Parser;

fn main() -> Result<(), String> {
    let mut XrandrParser = Parser::new();

    XrandrParser.parse()?;

    let connector = &XrandrParser.get_connector("HDMI-1")?;

    let available_refresh_rates = &connector.available_refresh_rates("1920x1080")?;

    println!("Available Refresh Rates: {:#?}", available_refresh_rates);

    Ok(())
}

Trait Implementations§

Source§

impl Clone for Connector

Source§

fn clone(&self) -> Connector

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 Connector

Source§

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

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

impl Default for Connector

Source§

fn default() -> Connector

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for Connector

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for Connector

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for Connector

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for Connector

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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> ToOwned for T
where T: Clone,

Source§

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

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.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,