pub struct EditorTextRun {
pub index: usize,
pub byte_range: Range<usize>,
pub baseline_y: f32,
pub layout: TextLayoutHandle,
}Expand description
One visible logical paragraph run in viewport coordinates.
byte_range addresses the source buffer while the layout text and helper
offsets are run-local. baseline_y is relative to the text viewport before
the caller adds its screen-space origin.
§Examples
use ailloli_ui_core::{Color, FontId, TextStyle};
use ailloli_ui_editor::layout::EditorTextRun;
use ailloli_ui_text::{TextLayoutParams, TextSystem};
let mut system = TextSystem::new();
let layout = system.layout_cached(TextLayoutParams::new(
"line", TextStyle::new(FontId::Mono, 13, Color::WHITE),
));
let run = EditorTextRun { index: 2, byte_range: 8..12, baseline_y: 18.0, layout };
assert_eq!(run.byte_range, 8..12);Fields§
§index: usizeZero-based logical paragraph index in the source buffer.
byte_range: Range<usize>Half-open UTF-8 byte range in the source, excluding a trailing newline.
baseline_y: f32First shaped baseline relative to the visible text viewport.
layout: TextLayoutHandleShared prepared layout for this paragraph’s newline-trimmed text.
Trait Implementations§
Source§impl Clone for EditorTextRun
impl Clone for EditorTextRun
Source§fn clone(&self) -> EditorTextRun
fn clone(&self) -> EditorTextRun
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for EditorTextRun
impl !RefUnwindSafe for EditorTextRun
impl Send for EditorTextRun
impl Sync for EditorTextRun
impl Unpin for EditorTextRun
impl !UnwindSafe for EditorTextRun
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