Struct minimad::Compound[][src]

pub struct Compound<'s> {
    pub src: &'s str,
    pub bold: bool,
    pub italic: bool,
    pub code: bool,
    pub strikeout: bool,
}

a Compound is a part of a line with a consistent styling. It can be part of word, several words, some inline code, or even the whole line.

Fields

src: &'s strbold: boolitalic: boolcode: boolstrikeout: bool

Implementations

impl<'s> Compound<'s>[src]

pub fn raw_str(src: &'s str) -> Compound<'s>[src]

make a raw unstyled compound Involves no parsing

pub fn set_str(&mut self, src: &'s str)[src]

change the content but keeps the style arguments

pub fn sub(&self, r_start: usize, r_end: usize) -> Compound<'s>[src]

return a sub part of the compound, with the same styling r_start is relative, that is 0 is the index of the first byte of this compound.

pub fn sub_chars(&self, r_start: usize, r_end: usize) -> Compound<'s>[src]

return a sub part of the compound, with the same styling r_start is relative, that is 0 is the index of the first char of this compound.

The difference with sub is that this method is unicode aware and counts the chars instead of asking for the bytes

pub fn tail(&self, r_start: usize) -> Compound<'s>[src]

return a sub part at end of the compound, with the same styling r_start is relative, that is if you give 0 you get a clone of this compound

pub fn tail_chars(&self, r_start: usize) -> Compound<'s>[src]

return a sub part at end of the compound, with the same styling r_start is relative, that is if you give 0 you get a clone of this compound

The difference with tail is that this method is unicode aware and counts the chars instead of asking for the bytes

pub fn cut_tail(&mut self, tail_size: usize) -> Compound<'s>[src]

pub fn raw_part(src: &'s str, start: usize, end: usize) -> Compound<'s>[src]

pub fn new(
    src: &'s str,
    start: usize,
    end: usize,
    bold: bool,
    italic: bool,
    code: bool,
    strikeout: bool
) -> Compound<'s>
[src]

pub fn bold(self) -> Compound<'s>[src]

pub fn italic(self) -> Compound<'s>[src]

pub fn code(self) -> Compound<'s>[src]

pub fn strikeout(self) -> Compound<'s>[src]

pub fn set_bold(&mut self, bold: bool)[src]

pub fn set_italic(&mut self, italic: bool)[src]

pub fn set_code(&mut self, code: bool)[src]

pub fn set_strikeout(&mut self, strikeout: bool)[src]

pub fn as_str(&self) -> &'s str[src]

pub fn char_length(&self) -> usize[src]

pub fn is_empty(&self) -> bool[src]

Trait Implementations

impl<'s> Clone for Compound<'s>[src]

impl Debug for Compound<'_>[src]

impl Display for Compound<'_>[src]

impl<'s> Eq for Compound<'s>[src]

impl<'s> Hash for Compound<'s>[src]

impl<'s> PartialEq<Compound<'s>> for Compound<'s>[src]

impl<'s> StructuralEq for Compound<'s>[src]

impl<'s> StructuralPartialEq for Compound<'s>[src]

Auto Trait Implementations

impl<'s> RefUnwindSafe for Compound<'s>[src]

impl<'s> Send for Compound<'s>[src]

impl<'s> Sync for Compound<'s>[src]

impl<'s> Unpin for Compound<'s>[src]

impl<'s> UnwindSafe for Compound<'s>[src]

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.