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: Stringstatus: Stringprimary: boolcurrent_resolution: Resolutioncurrent_refresh_rate: Stringprefered_resolution: Resolutionprefered_refresh_rate: Stringposition: Positionorientation: Stringavailable_orientations: Vec<String>physical_dimensions: Dimensionsoutput_info: Vec<Output>

Implementations

Sets the name field of this struct.

Sets the status field of this struct.

Sets the primary field of this struct.

Sets the current_resolution field of this struct.

Sets the current_refresh_rate field of this struct.

Sets the prefered_resolution field of this struct.

Sets the prefered_refresh_rate field of this struct.

Sets the position field of this struct.

Sets the orientation field of this struct.

Sets the available_orientations field of this struct.

Sets the physical_dimensions field of this struct.

Sets the output_info field of this struct.

Create a new instance of Connector

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(())
}

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(())
}

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(())
}

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(())
}

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(())
}

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(())
}

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(())
}

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(())
}

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(())
}

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(())
}

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(())
}

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(())
}

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(())
}

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(())
}

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

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

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

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The resulting type after obtaining ownership.

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

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

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.