Struct txtframe::TextFrame

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

The abstract representation of a TextFrame.

Examples


let mut text_frame = TextFrame::new()
    .frame_var(&FrameVar::Space)
    .algn(Algn::Centr)
    .color_fra(Color::Red)
    .color_txt(Color::Cyan)
    .color_fill(Color::Magenta)
    .expand(2)
    .width(10)
    .expand_width(2)
    .expand_height(2)
    .left_top('┏')
    .top_line('╍')
    .right_top('┓')
    .vert_left('┋')
    .vert_right('┋')
    .left_btm('┗')
    .btm_line('╍')
    .right_btm('┛')
    .fill('░');

Implementations§

source§

impl TextFrame

source

pub fn new() -> Self

Construct an empty frame.

source

pub fn frame_var(self, vars: &FrameVar) -> Self

Select preset frames.

source

pub fn frame_iter<'a>(&'a self, text: &'a str) -> impl Iterator<Item = &str>

Create an iterator frame.

source

pub fn left_top(self, ch: char) -> Self

Value for top left corner.

source

pub fn top_line(self, ch: char) -> Self

Value for top line.

source

pub fn right_top(self, ch: char) -> Self

Value for top right corner.

source

pub fn vert_left(self, ch: char) -> Self

Value for left vertical line.

source

pub fn vert_right(self, ch: char) -> Self

Value for right vertical line.

source

pub fn left_btm(self, ch: char) -> Self

Value for bottom left corner.

source

pub fn btm_line(self, ch: char) -> Self

Value for bottom line.

source

pub fn right_btm(self, ch: char) -> Self

Value for bottom right corner.

source

pub fn width(self, width: usize) -> Self

Value for frame width.

source

pub fn height(self, height: usize) -> Self

Value for frame height.

source

pub fn expand_width(self, width: usize) -> Self

Value for frame width expand.

source

pub fn expand_height(self, height: usize) -> Self

Value for frame height expand.

source

pub fn expand(self, expand: usize) -> Self

Value for frame expand.

source

pub fn algn(self, algn: Algn) -> Self

Value for align expand.

source

pub fn fill(self, fill: char) -> Self

Value for fill expand.

source

pub fn color_fra(self, color: Color) -> Self

Specifies the frame color.

source

pub fn color_txt(self, color: Color) -> Self

Specifies the text color.

source

pub fn color_fill(self, color: Color) -> Self

Specifies the fill color.

Trait Implementations§

source§

impl Clone for TextFrame

source§

fn clone(&self) -> TextFrame

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 TextFrame

source§

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

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

impl Default for TextFrame

source§

fn default() -> TextFrame

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

impl PartialEq<TextFrame> for TextFrame

source§

fn eq(&self, other: &TextFrame) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Eq for TextFrame

source§

impl StructuralEq for TextFrame

source§

impl StructuralPartialEq for TextFrame

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere 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> ToOwned for Twhere T: Clone,

§

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, U> TryFrom<U> for Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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.