Struct MultiLineText
pub struct MultiLineText<'a, Coord, T>{ /* private fields */ }Expand description
An multi-line text element. The Text element allows only single line text
and the MultiLineText supports drawing multiple lines
Implementations§
§impl<'a, Coord, T> MultiLineText<'a, Coord, T>
impl<'a, Coord, T> MultiLineText<'a, Coord, T>
pub fn new<S>(pos: Coord, style: S) -> MultiLineText<'a, Coord, T>
pub fn new<S>(pos: Coord, style: S) -> MultiLineText<'a, Coord, T>
Create an empty multi-line text element.
Lines can be append to the empty multi-line by calling push_line method
pos: The upper left corner
style: The style of the text
pub fn set_line_height(
&mut self,
value: f64,
) -> &mut MultiLineText<'a, Coord, T>
pub fn set_line_height( &mut self, value: f64, ) -> &mut MultiLineText<'a, Coord, T>
Set the line height of the multi-line text element
pub fn push_line<L>(&mut self, line: L)where
L: Into<T>,
pub fn push_line<L>(&mut self, line: L)where
L: Into<T>,
Push a new line into the given multi-line text
line: The line to be pushed
pub fn estimate_dimension(
&self,
) -> Result<(i32, i32), <FontDataInternal as FontData>::ErrorType>
pub fn estimate_dimension( &self, ) -> Result<(i32, i32), <FontDataInternal as FontData>::ErrorType>
Estimate the multi-line text element’s dimension
pub fn relocate(&mut self, coord: Coord)
pub fn relocate(&mut self, coord: Coord)
Move the location to the specified location
§impl<'a, T> MultiLineText<'a, (i32, i32), T>
impl<'a, T> MultiLineText<'a, (i32, i32), T>
§impl<'a, Coord> MultiLineText<'a, Coord, &'a str>
impl<'a, Coord> MultiLineText<'a, Coord, &'a str>
pub fn from_str<ST, S>(
text: ST,
pos: Coord,
style: S,
max_width: u32,
) -> MultiLineText<'a, Coord, &'a str>
pub fn from_str<ST, S>( text: ST, pos: Coord, style: S, max_width: u32, ) -> MultiLineText<'a, Coord, &'a str>
Parse a multi-line text into an multi-line element.
text: The text that is parsed
pos: The position of the text
style: The style for this text
max_width: The width of the multi-line text element, the line will break
into two lines if the line is wider than the max_width. If 0 is given, do not
do any line wrapping
§impl<'a, Coord> MultiLineText<'a, Coord, String>
impl<'a, Coord> MultiLineText<'a, Coord, String>
pub fn from_string<S>(
text: String,
pos: Coord,
style: S,
max_width: u32,
) -> MultiLineText<'a, Coord, String>
pub fn from_string<S>( text: String, pos: Coord, style: S, max_width: u32, ) -> MultiLineText<'a, Coord, String>
Parse a multi-line text into an multi-line element.
text: The text that is parsed
pos: The position of the text
style: The style for this text
max_width: The width of the multi-line text element, the line will break
into two lines if the line is wider than the max_width. If 0 is given, do not
do any line wrapping
Trait Implementations§
§impl<'a, Coord, DB, T> Drawable<DB> for MultiLineText<'a, Coord, T>
impl<'a, Coord, DB, T> Drawable<DB> for MultiLineText<'a, Coord, T>
§impl<'b, 'a, Coord, T> PointCollection<'a, Coord> for &'a MultiLineText<'b, Coord, T>
impl<'b, 'a, Coord, T> PointCollection<'a, Coord> for &'a MultiLineText<'b, Coord, T>
§fn point_iter(
self,
) -> <&'a MultiLineText<'b, Coord, T> as PointCollection<'a, Coord>>::IntoIter
fn point_iter( self, ) -> <&'a MultiLineText<'b, Coord, T> as PointCollection<'a, Coord>>::IntoIter
Auto Trait Implementations§
impl<'a, Coord, T> Freeze for MultiLineText<'a, Coord, T>where
Coord: Freeze,
impl<'a, Coord, T> RefUnwindSafe for MultiLineText<'a, Coord, T>where
Coord: RefUnwindSafe,
T: RefUnwindSafe,
impl<'a, Coord, T> Send for MultiLineText<'a, Coord, T>
impl<'a, Coord, T> Sync for MultiLineText<'a, Coord, T>
impl<'a, Coord, T> Unpin for MultiLineText<'a, Coord, T>
impl<'a, Coord, T> UnwindSafe for MultiLineText<'a, Coord, T>where
Coord: UnwindSafe,
T: UnwindSafe,
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
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<'b, T, DB, Coord> IntoDynElement<'b, DB, Coord> for Twhere
T: Drawable<DB> + 'b,
&'a T: for<'a> PointCollection<'a, Coord>,
Coord: Clone,
DB: DrawingBackend,
impl<'b, T, DB, Coord> IntoDynElement<'b, DB, Coord> for Twhere
T: Drawable<DB> + 'b,
&'a T: for<'a> PointCollection<'a, Coord>,
Coord: Clone,
DB: DrawingBackend,
§fn into_dyn(self) -> DynElement<'b, DB, Coord>
fn into_dyn(self) -> DynElement<'b, DB, Coord>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more