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
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.
Source§impl 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(())
}