pub struct Builder { /* private fields */ }Expand description
Builds and modifies a Text, based on replacements applied
to it.
The generation of text by the [TextBuilder] has a few
peculiarities that are convenient in the situations where it is
useful:
- The user cannot insert
Tags directly, only by appending and modifying existing tags. - All
Tags that are appended result in an inverseTagbeing placed before the next one, or at the end of the [Tags] (e.g.Tag::PushFormwould be followed aTag::PopForm). - You can insert swappable text with
[
push_swappable()][Self::push_swappable].
These properties allow for quick and easy modification of the
Text within, which can then be accessed with
text.
Implementations§
source§impl Builder
impl Builder
pub fn new() -> Self
pub fn finish(self) -> Text
pub fn push_str(&mut self, display: impl Display)
pub fn push_text(&mut self, text: Text)
pub fn push_part<D: Display>(&mut self, part: BuilderPart<D>)
pub fn clear(&mut self)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Builder
impl !RefUnwindSafe for Builder
impl Send for Builder
impl Sync for Builder
impl Unpin for Builder
impl !UnwindSafe for Builder
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more