Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Impl Display for connectors (and more) #195

Merged
merged 2 commits into from
Apr 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/control/connector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,12 @@ pub struct Info {
pub(crate) subpixel: SubPixel,
}

impl std::fmt::Display for Info {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{}-{}", self.interface.as_str(), self.interface_id)
}
}

impl Info {
/// Returns the handle to this connector.
pub fn handle(&self) -> Handle {
Expand Down
6 changes: 6 additions & 0 deletions src/control/crtc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,12 @@ pub struct Info {
pub(crate) gamma_length: u32,
}

impl std::fmt::Display for Info {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "CRTC {}", self.handle.0)
}
}

impl Info {
/// Returns the handle to this CRTC.
pub fn handle(&self) -> Handle {
Expand Down
6 changes: 6 additions & 0 deletions src/control/encoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,12 @@ pub struct Info {
pub(crate) pos_clones: u32,
}

impl std::fmt::Display for Info {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "Encoder {}", self.handle.0)
}
}

impl Info {
/// Returns the handle to this encoder.
pub fn handle(&self) -> Handle {
Expand Down
6 changes: 6 additions & 0 deletions src/control/framebuffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@ pub struct Info {
pub(crate) buffer: Option<buffer::Handle>,
}

impl std::fmt::Display for Info {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "Framebuffer {}", self.handle.0)
}
}

impl Info {
/// Returns the handle to this framebuffer.
pub fn handle(&self) -> Handle {
Expand Down
6 changes: 6 additions & 0 deletions src/control/plane.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,12 @@ pub struct Info {
pub(crate) formats: Vec<u32>,
}

impl std::fmt::Display for Info {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "Plane {}", self.handle.0)
}
}

impl Info {
/// Returns the handle to this plane.
pub fn handle(&self) -> Handle {
Expand Down
Loading