pub struct Builder<'a> { /* private fields */ }
Expand description
A context for building some Text.
Implementations§
source§impl<'a> Builder<'a>
impl<'a> Builder<'a>
sourcepub fn line_wrap(self, line_wrap: Option<Wrap>) -> Self
pub fn line_wrap(self, line_wrap: Option<Wrap>) -> Self
Specify whether or not text should be wrapped around some width and how to do so.
The default value is DEFAULT_LINE_WRAP
.
sourcepub fn no_line_wrap(self) -> Self
pub fn no_line_wrap(self) -> Self
Specify that the Text should not wrap lines around the width.
Shorthand for builder.line_wrap(None)
.
sourcepub fn wrap_by_word(self) -> Self
pub fn wrap_by_word(self) -> Self
Line wrap the Text at the beginning of the first word that exceeds the width.
Shorthand for builder.line_wrap(Some(Wrap::Whitespace))
.
sourcepub fn wrap_by_character(self) -> Self
pub fn wrap_by_character(self) -> Self
Line wrap the Text at the beginning of the first character that exceeds the width.
Shorthand for builder.line_wrap(Some(Wrap::Character))
.
sourcepub fn font(self, font: Font) -> Self
pub fn font(self, font: Font) -> Self
A method for specifying the Font
used for displaying the Text
.
sourcepub fn justify(self, justify: Justify) -> Self
pub fn justify(self, justify: Justify) -> Self
Describe the end along the x axis to which the text should be aligned.
sourcepub fn left_justify(self) -> Self
pub fn left_justify(self) -> Self
Align the text to the left of its bounding Rect’s x axis range.
sourcepub fn center_justify(self) -> Self
pub fn center_justify(self) -> Self
Align the text to the middle of its bounding Rect’s x axis range.
sourcepub fn right_justify(self) -> Self
pub fn right_justify(self) -> Self
Align the text to the right of its bounding Rect’s x axis range.
sourcepub fn line_spacing(self, spacing: Scalar) -> Self
pub fn line_spacing(self, spacing: Scalar) -> Self
Specify how much vertical space should separate each line of text.
sourcepub fn y_align(self, align: Align) -> Self
pub fn y_align(self, align: Align) -> Self
Specify how the whole text should be aligned along the y axis of its bounding rectangle
sourcepub fn align_top(self) -> Self
pub fn align_top(self) -> Self
Align the top edge of the text with the top edge of its bounding rectangle.
sourcepub fn align_middle_y(self) -> Self
pub fn align_middle_y(self) -> Self
Align the middle of the text with the middle of the bounding rect along the y axis..
This is the default behaviour.
sourcepub fn align_bottom(self) -> Self
pub fn align_bottom(self) -> Self
Align the bottom edge of the text with the bottom edge of its bounding rectangle.
sourcepub fn build(self, rect: Rect) -> Text<'a>
pub fn build(self, rect: Rect) -> Text<'a>
Build the text.
This iterates over the text in order to pre-calculates the text’s multi-line information
using the line::infos
function.
The given rect
will be used for applying the layout including text alignment, positioning
of text, multi-line wrapping, etc,
Trait Implementations§
Auto Trait Implementations§
impl<'a> RefUnwindSafe for Builder<'a>
impl<'a> Send for Builder<'a>
impl<'a> Sync for Builder<'a>
impl<'a> Unpin for Builder<'a>
impl<'a> UnwindSafe for Builder<'a>
Blanket Implementations§
source§impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for S
impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for S
source§fn adapt_into_using<M>(self, method: M) -> Dwhere
M: TransformMatrix<Swp, Dwp, T>,
fn adapt_into_using<M>(self, method: M) -> Dwhere
M: TransformMatrix<Swp, Dwp, T>,
source§fn adapt_into(self) -> D
fn adapt_into(self) -> D
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
source§impl<T, U> ConvertInto<U> for Twhere
U: ConvertFrom<T>,
impl<T, U> ConvertInto<U> for Twhere
U: ConvertFrom<T>,
source§fn convert_into(self) -> U
fn convert_into(self) -> U
source§fn convert_unclamped_into(self) -> U
fn convert_unclamped_into(self) -> U
source§fn try_convert_into(self) -> Result<U, OutOfBounds<U>>
fn try_convert_into(self) -> Result<U, OutOfBounds<U>>
OutOfBounds
error is returned which contains the unclamped color. Read more