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: Screen
The Virtual Screen
Implementations§
Source§impl 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 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>
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§
Source§impl<'de> Deserialize<'de> for Parser
impl<'de> Deserialize<'de> for Parser
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for Parser
impl RefUnwindSafe for Parser
impl Send for Parser
impl Sync for Parser
impl Unpin for Parser
impl UnwindSafe for Parser
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more