Struct minimad::Compound[][src]

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

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]

fn clone(&self) -> Compound<'s>[src]

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl Debug for Compound<'_>[src]

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

Formats the value using the given formatter. Read more

impl Display for Compound<'_>[src]

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

Formats the value using the given formatter. Read more

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

fn hash<__H: Hasher>(&self, state: &mut __H)[src]

Feeds this value into the given Hasher. Read more

fn hash_slice<H>(data: &[Self], state: &mut H) where
    H: Hasher
1.3.0[src]

Feeds a slice of this type into the given Hasher. Read more

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

fn eq(&self, other: &Compound<'s>) -> bool[src]

This method tests for self and other values to be equal, and is used by ==. Read more

fn ne(&self, other: &Compound<'s>) -> bool[src]

This method tests for !=.

impl<'s> Eq 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>

impl<'s> Send for Compound<'s>

impl<'s> Sync for Compound<'s>

impl<'s> Unpin for Compound<'s>

impl<'s> UnwindSafe for Compound<'s>

Blanket Implementations

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

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

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

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

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

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

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

pub fn from(t: T) -> T[src]

Performs the conversion.

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

pub fn into(self) -> U[src]

Performs the conversion.

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

type Owned = T

The resulting type after obtaining ownership.

pub fn to_owned(&self) -> T[src]

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

pub fn clone_into(&self, target: &mut T)[src]

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

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

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

pub default fn to_string(&self) -> String[src]

Converts the given value to a String. Read more

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.

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

Performs the conversion.

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.

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

Performs the conversion.