Trait radicle_cli::terminal::Element
source · pub trait Element:
Debug
+ Send
+ Sync {
// Required methods
fn size(&self, parent: Constraint) -> Size;
fn render(&self, parent: Constraint) -> Vec<Line>;
// Provided methods
fn columns(&self, parent: Constraint) -> usize { ... }
fn rows(&self, parent: Constraint) -> usize { ... }
fn print(&self) { ... }
fn write(&self, constraints: Constraint) -> Result<(), Error>
where Self: Sized { ... }
fn display(&self, constraints: Constraint) -> String { ... }
}Expand description
A text element that has a size and can be rendered to the terminal.
Required Methods§
sourcefn size(&self, parent: Constraint) -> Size
fn size(&self, parent: Constraint) -> Size
Get the size of the element, in rows and columns.
sourcefn render(&self, parent: Constraint) -> Vec<Line>
fn render(&self, parent: Constraint) -> Vec<Line>
Render the element as lines of text that can be printed.
Provided Methods§
sourcefn columns(&self, parent: Constraint) -> usize
fn columns(&self, parent: Constraint) -> usize
Get the number of columns occupied by this element.
sourcefn rows(&self, parent: Constraint) -> usize
fn rows(&self, parent: Constraint) -> usize
Get the number of rows occupied by this element.
sourcefn write(&self, constraints: Constraint) -> Result<(), Error>where
Self: Sized,
fn write(&self, constraints: Constraint) -> Result<(), Error>where
Self: Sized,
Write using the given constraints to stdout.
sourcefn display(&self, constraints: Constraint) -> String
fn display(&self, constraints: Constraint) -> String
Return a string representation of this element.
Trait Implementations§
source§impl<'a> Element for Box<dyn Element + 'a>
impl<'a> Element for Box<dyn Element + 'a>
source§fn size(&self, parent: Constraint) -> Size
fn size(&self, parent: Constraint) -> Size
Get the size of the element, in rows and columns.
source§fn render(&self, parent: Constraint) -> Vec<Line>
fn render(&self, parent: Constraint) -> Vec<Line>
Render the element as lines of text that can be printed.
source§fn columns(&self, parent: Constraint) -> usize
fn columns(&self, parent: Constraint) -> usize
Get the number of columns occupied by this element.
source§fn rows(&self, parent: Constraint) -> usize
fn rows(&self, parent: Constraint) -> usize
Get the number of rows occupied by this element.
source§fn write(&self, constraints: Constraint) -> Result<(), Error>where
Self: Sized,
fn write(&self, constraints: Constraint) -> Result<(), Error>where
Self: Sized,
Write using the given constraints to
stdout.source§fn display(&self, constraints: Constraint) -> String
fn display(&self, constraints: Constraint) -> String
Return a string representation of this element.