Struct xrandr_parser::Parser
source · [−]pub struct Parser {
pub outputs: Vec<String>,
pub connected_outputs: Vec<String>,
pub connectors: Vec<Connector>,
pub screen: Screen,
}Fields
outputs: Vec<String>Every Connector.name
connected_outputs: Vec<String>Every Connector.name where Connector.status is true
connectors: Vec<Connector>Every Connector Struct
screen: ScreenThe Virtual Screen
Implementations
sourceimpl Parser
impl Parser
sourcepub fn parse(&mut self) -> Result<(), String>
pub fn parse(&mut self) -> Result<(), String>
Populate properties of an instance of Parser from the output of Parser::parse_query()
sourcepub fn outputs(&self) -> Vec<String>
pub fn outputs(&self) -> Vec<String>
Getter function for Parser.outputs
Example
ⓘ
#[allow(non_snake_case)]
use xrandr_parser::Parser;
fn main() -> Result<(), String> {
let mut XrandrParser = Parser::new();
XrandrParser.parse()?;
let outputs = &XrandrParser.outputs();
Ok(())
}sourcepub fn connected_outputs(&self) -> Vec<String>
pub fn connected_outputs(&self) -> Vec<String>
Getter function for Parser.connected_outputs
Example
ⓘ
#[allow(non_snake_case)]
use xrandr_parser::Parser;
fn main() -> Result<(), String> {
let mut XrandrParser = Parser::new();
XrandrParser.parse()?;
let connected_outputs = &XrandrParser.connected_outputs();
println!("Connected Outputs: {:?}", connected_outputs);
Ok(())
}sourcepub fn connectors(&self) -> Vec<Connector>
pub fn connectors(&self) -> Vec<Connector>
Getter function for Parser.connectors
Example
ⓘ
#[allow(non_snake_case)]
use xrandr_parser::Parser;
fn main() -> Result<(), String> {
let mut XrandrParser = Parser::new();
XrandrParser.parse()?;
let connectors = &XrandrParser.connectors();
println!("Connectors: {:#?}", connectors);
Ok(())
}sourcepub fn screen(&self) -> Screen
pub fn screen(&self) -> Screen
Getter function for Parser.screen
Example
ⓘ
#[allow(non_snake_case)]
use xrandr_parser::Parser;
fn main() -> Result<(), String> {
let mut XrandrParser = Parser::new();
XrandrParser.parse()?;
let screen = &XrandrParser.screen();
println!("Screen Information: {:#?}", screen);
Ok(())
}sourcepub fn get_connector(&self, connector: &str) -> Result<Connector, String>
pub fn get_connector(&self, connector: &str) -> Result<Connector, String>
Get the connector struct for a with the name provided. Returns "Not found" if the connector
is not found in self.connectors.
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")?;
println!("Connector - HDMI-1: {:#?}", connector);
Ok(())
}Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Parser
impl Send for Parser
impl Sync for Parser
impl Unpin for Parser
impl UnwindSafe for Parser
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