Struct xrandr_parser::connector::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: 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
sourceimpl Connector
impl Connector
sourcepub fn set_status(&mut self, value: String) -> &mut Self
pub fn set_status(&mut self, value: String) -> &mut Self
Sets the status field of this struct.
sourcepub fn set_primary(&mut self, value: bool) -> &mut Self
pub fn set_primary(&mut self, value: bool) -> &mut Self
Sets the primary field of this struct.
sourcepub fn set_current_resolution(&mut self, value: Resolution) -> &mut Self
pub fn set_current_resolution(&mut self, value: Resolution) -> &mut Self
Sets the current_resolution field of this struct.
sourcepub fn set_current_refresh_rate(&mut self, value: String) -> &mut Self
pub fn set_current_refresh_rate(&mut self, value: String) -> &mut Self
Sets the current_refresh_rate field of this struct.
sourcepub fn set_prefered_resolution(&mut self, value: Resolution) -> &mut Self
pub fn set_prefered_resolution(&mut self, value: Resolution) -> &mut Self
Sets the prefered_resolution field of this struct.
sourcepub fn set_prefered_refresh_rate(&mut self, value: String) -> &mut Self
pub fn set_prefered_refresh_rate(&mut self, value: String) -> &mut Self
Sets the prefered_refresh_rate field of this struct.
sourcepub fn set_position(&mut self, value: Position) -> &mut Self
pub fn set_position(&mut self, value: Position) -> &mut Self
Sets the position field of this struct.
sourcepub fn set_orientation(&mut self, value: String) -> &mut Self
pub fn set_orientation(&mut self, value: String) -> &mut Self
Sets the orientation field of this struct.
sourcepub fn set_available_orientations(&mut self, value: Vec<String>) -> &mut Self
pub fn set_available_orientations(&mut self, value: Vec<String>) -> &mut Self
Sets the available_orientations field of this struct.
sourcepub fn set_physical_dimensions(&mut self, value: Dimensions) -> &mut Self
pub fn set_physical_dimensions(&mut self, value: Dimensions) -> &mut Self
Sets the physical_dimensions field of this struct.
sourcepub fn set_output_info(&mut self, value: Vec<Output>) -> &mut Self
pub fn set_output_info(&mut self, value: Vec<Output>) -> &mut Self
Sets the output_info field of this struct.
sourceimpl Connector
impl Connector
sourcepub fn name(&self) -> String
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(())
}sourcepub fn status(&self) -> String
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(())
}sourcepub fn primary(&self) -> bool
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(())
}sourcepub fn current_resolution(&self) -> Resolution
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(())
}sourcepub fn current_refresh_rate(&self) -> String
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(())
}sourcepub fn prefered_resolution(&self) -> Resolution
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(())
}sourcepub fn prefered_refresh_rate(&self) -> String
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(())
}sourcepub fn position(&self) -> Position
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(())
}sourcepub fn orientation(&self) -> String
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(())
}sourcepub fn available_orientations(&self) -> Vec<String>
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(())
}sourcepub fn physical_dimensions(&self) -> Dimensions
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(())
}sourcepub fn output_info(&self) -> Vec<Output>
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(())
}sourcepub fn available_resolutions(&self) -> Result<Vec<Resolution>, String>
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(())
}sourcepub fn available_resolutions_pretty(&self) -> Result<Vec<String>, String>
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(())
}sourcepub fn available_refresh_rates(
&self,
target_resolution: &str
) -> Result<Vec<String>, String>
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
impl StructuralPartialEq for Connector
Auto Trait Implementations
impl RefUnwindSafe for Connector
impl Send for Connector
impl Sync for Connector
impl Unpin for Connector
impl UnwindSafe for Connector
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more