pub struct ParagraphMetricsMetadata {
pub paragraph_count: usize,
pub dirty_range: Option<Range<usize>>,
pub local_version: u64,
pub total_height: f32,
pub max_width: f32,
/* private fields */
}Expand description
Aggregate metadata from the most recent layout pass.
A first pass has no prior revision set and therefore reports
dirty_range == None. Later changes use a half-open paragraph-index range;
a changed paragraph count marks 0..paragraph_count dirty.
§Examples
use ailloli_ui_core::Rect;
use ailloli_ui_editor::{layout::{build_visible_text_layout, LayoutCache, ParagraphMetricsCache}, EditorConfig, EditorStyle, EditorViewport};
use ailloli_ui_text::{TextBuffer, TextEditState, TextSystem};
let buffer = TextBuffer::from_string("a\nb");
let viewport = EditorViewport::new(Rect::new(0.0, 0.0, 100.0, 60.0), EditorConfig::default(), &TextEditState::new());
let (mut layouts, mut metrics, mut text_system) = (LayoutCache::default(), ParagraphMetricsCache::default(), TextSystem::new());
build_visible_text_layout(&buffer, viewport, EditorStyle::default(), &mut layouts, &mut metrics, &mut text_system);
assert_eq!(metrics.metadata().unwrap().paragraph_count, 2);Fields§
§paragraph_count: usizeNumber of logical paragraphs observed in the last pass.
dirty_range: Option<Range<usize>>Smallest half-open range whose stored revisions changed, if any.
local_version: u64Maximum paragraph revision, or zero for no paragraphs.
total_height: f32Sum of visible paragraph heights in logical pixels.
max_width: f32Maximum visible paragraph width in logical pixels.
Trait Implementations§
Source§impl Clone for ParagraphMetricsMetadata
impl Clone for ParagraphMetricsMetadata
Source§fn clone(&self) -> ParagraphMetricsMetadata
fn clone(&self) -> ParagraphMetricsMetadata
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 moreSource§impl Debug for ParagraphMetricsMetadata
impl Debug for ParagraphMetricsMetadata
Source§impl PartialEq for ParagraphMetricsMetadata
impl PartialEq for ParagraphMetricsMetadata
impl StructuralPartialEq for ParagraphMetricsMetadata
Auto Trait Implementations§
impl Freeze for ParagraphMetricsMetadata
impl RefUnwindSafe for ParagraphMetricsMetadata
impl Send for ParagraphMetricsMetadata
impl Sync for ParagraphMetricsMetadata
impl Unpin for ParagraphMetricsMetadata
impl UnwindSafe for ParagraphMetricsMetadata
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