pub struct TextLine<'a> {
pub byte_range: Range<usize>,
pub text: &'a str,
pub suffix: &'static str,
pub width: f32,
}Expand description
One borrowed line. text followed by suffix is the complete displayed copy.
Empty lines still occupy one line slot. Ranges are always UTF-8 boundaries.
use ferravex_render::ui::text_layout::{LineLimit, WrappedText};
let copy = "é日ABC DEF";
let layout = WrappedText::new(copy, 30., 8.)?.with_limit(LineLimit::Ellipsis(1));
let line = layout.lines().next().unwrap();
assert_eq!(©[line.byte_range], line.text);
assert_eq!((line.text, line.suffix, line.width), ("é日", "...", 30.));Fields§
§byte_range: Range<usize>Range of text in the original source, excluding skipped separators and
any tail replaced by an ellipsis. The suffix has no source range.
text: &'a strBorrowed visible prefix, without a line separator.
suffix: &'static strStatic ASCII marker, or the empty string.
width: f32Advance of prefix plus suffix, including the final spacing column. A hard-wrapped cell can exceed the requested width when it is too narrow.
Trait Implementations§
impl<'a> StructuralPartialEq for TextLine<'a>
Auto Trait Implementations§
impl<'a> Freeze for TextLine<'a>
impl<'a> RefUnwindSafe for TextLine<'a>
impl<'a> Send for TextLine<'a>
impl<'a> Sync for TextLine<'a>
impl<'a> Unpin for TextLine<'a>
impl<'a> UnwindSafe for TextLine<'a>
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