Struct radicle_cli::terminal::Line

source ·
pub struct Line { /* private fields */ }
Expand description

A line of text that has styling and can be displayed.

Implementations§

source§

impl Line

source

pub fn new(item: impl Into<Label>) -> Line

Create a new line.

source

pub fn blank() -> Line

Create a blank line.

source

pub fn style(self, style: Style) -> Line

Return a styled line by styling all its labels.

source

pub fn spaced(items: impl IntoIterator<Item = Label>) -> Line

Return a line with a single space between the given labels.

source

pub fn item(self, item: impl Into<Label>) -> Line

Add an item to this line.

source

pub fn extend(self, items: impl IntoIterator<Item = Label>) -> Line

Add multiple items to this line.

source

pub fn push(&mut self, item: impl Into<Label>)

Add an item to this line.

source

pub fn pad(&mut self, width: usize)

Pad this line to occupy the given width.

source

pub fn truncate(&mut self, width: usize, delim: &str)

Truncate this line to the given width.

source

pub fn width(&self) -> usize

Get the actual column width of this line.

source

pub fn space(self) -> Line

Create a line that contains a single space.

source

pub fn boxed(self) -> Box<dyn Element>

Box this line as an Element.

source

pub fn filled(self, color: Color) -> Filled<Line>

Return a filled line.

Trait Implementations§

source§

impl Cell for Line

source§

type Truncated = Line

Type after truncation.
source§

type Padded = Line

Type after padding.
source§

fn width(&self) -> usize

Cell display width in number of terminal columns.
source§

fn pad(&self, width: usize) -> <Line as Cell>::Padded

Pad the cell so that it is the given width, while keeping the content left-aligned.
source§

fn truncate(&self, width: usize, delim: &str) -> <Line as Cell>::Truncated

Truncate cell if longer than given width. Shows the delimiter if truncated.
source§

fn background(&self) -> Color

Background color of cell.
source§

impl Clone for Line

source§

fn clone(&self) -> Line

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Line

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
source§

impl Default for Line

source§

fn default() -> Line

Returns the “default value” for a type. Read more
source§

impl Display for Line

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
source§

impl Element for Line

source§

fn size(&self, _parent: Constraint) -> Size

Get the size of the element, in rows and columns.
source§

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

Get the number of columns occupied by this element.
source§

fn rows(&self, parent: Constraint) -> usize

Get the number of rows occupied by this element.
source§

fn print(&self)

Print this element to stdout.
source§

fn write(&self, constraints: Constraint) -> Result<(), Error>
where Self: Sized,

Write using the given constraints to stdout.
source§

fn display(&self, constraints: Constraint) -> String

Return a string representation of this element.
source§

impl<T> From<T> for Line
where T: Into<Label>,

source§

fn from(value: T) -> Line

Converts to this type from the input type.
source§

impl From<Vec<Label>> for Line

source§

fn from(items: Vec<Label>) -> Line

Converts to this type from the input type.
source§

impl IntoIterator for Line

source§

type Item = Label

The type of the elements being iterated over.
source§

type IntoIter = Box<dyn Iterator<Item = Label>>

Which kind of iterator are we turning this into?
source§

fn into_iter(self) -> <Line as IntoIterator>::IntoIter

Creates an iterator from a value. Read more

Auto Trait Implementations§

§

impl Freeze for Line

§

impl RefUnwindSafe for Line

§

impl Send for Line

§

impl Sync for Line

§

impl Unpin for Line

§

impl UnwindSafe for Line

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> CloneToUninit for T
where T: Clone,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> DynClone for T
where T: Clone,

source§

fn __clone_box(&self, _: Private) -> *mut ()

source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same for T

source§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where T: Clone,

source§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

source§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.