pub struct Label { /* private fields */ }Expand description
A structure representing a text label that can be drawn on a console at a specific position.
Implementations§
Source§impl Label
impl Label
Sourcepub fn draw(&self, stdout: &mut impl Write) -> Result<()>
pub fn draw(&self, stdout: &mut impl Write) -> Result<()>
Draws the label at the specified (x, y) coordinates in the console.
§Arguments
stdout- A mutable reference to any type that implements theWritetrait, allowing the method to write the label’s text to the specified output.
§Errors
Returns an io::Result<()>, which will contain an error if the write operation fails.
§Example
use std::io::{self, Write};
let mut stdout = io::stdout();
let label = Label::new("Hello, world!", 10, 5);
label.draw(&mut stdout).unwrap(); // Draws the labelAuto Trait Implementations§
impl Freeze for Label
impl RefUnwindSafe for Label
impl Send for Label
impl Sync for Label
impl Unpin for Label
impl UnwindSafe for Label
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