Struct minimad::Compound [−][src]
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 str
bold: bool
italic: bool
code: bool
strikeout: 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]
src: &'s str,
start: usize,
end: usize,
bold: bool,
italic: bool,
code: bool,
strikeout: bool
) -> Compound<'s>
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]
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
pub fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
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]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
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]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,