[−][src]Struct ornament::Decorator
A helper type to build a Text
instance.
It can be used in several manners.
Methods
impl<F> Decorator<F> where
F: Clone + Default + PartialEq,
[src]
F: Clone + Default + PartialEq,
pub fn new() -> Decorator<F>
[src]
Creates a new empty Decorator
.
pub fn with_text(text: &str) -> Decorator<F>
[src]
Creates a new Decorator
initialized with text
.
pub fn current_face(&self) -> &F
[src]
Returns the current face. On init this value will be equivalent to F::default()
.
This face is mostly used by append
which will assign the current face to the appended
text.
pub fn set_face(&mut self, face: F) -> &mut Self
[src]
Sets the current face.
This method is chainable.
pub fn reset_face(&mut self) -> &mut Self
[src]
Resets the current face. This is equivalent to calling set_face
with F::default()
.
This method is chainable.
pub fn append(&mut self, text: &str) -> &mut Self
[src]
Appends text
to the buffer and assigns it the current face.
This method is chainable.
pub fn set(&mut self, face: F, range: Range<usize>) -> &mut Self
[src]
Assigns face
to the given range. It overrides all faces previously assigned to this range.
This method is chainable.
pub fn build(&mut self) -> Text<F>
[src]
Processes all face assignations and returns the corresponding Text
.
Trait Implementations
Auto Trait Implementations
impl<F> Send for Decorator<F> where
F: Send,
F: Send,
impl<F> Unpin for Decorator<F> where
F: Unpin,
F: Unpin,
impl<F> Sync for Decorator<F> where
F: Sync,
F: Sync,
impl<F> RefUnwindSafe for Decorator<F> where
F: RefUnwindSafe,
F: RefUnwindSafe,
impl<F> UnwindSafe for Decorator<F> where
F: UnwindSafe,
F: UnwindSafe,
Blanket Implementations
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
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.
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>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,