Skip to main content

ParagraphStore

Struct ParagraphStore 

Source
pub struct ParagraphStore { /* private fields */ }
Expand description

Compact flat store of all compiled paragraphs for a surface.

Shared by TaffyStoreLayout, YogaLayoutEngine, SkiaBackend, and nativeview-runtime.

Implementations§

Source§

impl ParagraphStore

Source

pub fn sync_changes( &mut self, store: &NodeStore, changes: &ChangeSet, inherited: InheritedText<'_>, interaction: Option<&InteractionTracker>, defer_compile: bool, )

Synchronizes paragraph spans for one committed ChangeSet.

Source

pub fn sync_inherited_paragraph( &mut self, store: &NodeStore, pid: NodeId, parent_text: ResolvedTextStyle, parent_rtl: bool, interaction: Option<&InteractionTracker>, responsive: Option<ResponsiveTextEnv<'_>>, ) -> (bool, bool)

Compiles or updates paragraph root pid during a box-tree inheritance walk (parent_text, parent_rtl are the resolved inherited values of pid’s parent box). Returns (layout_changed, paint_changed).

Source

pub fn recompile_paragraph( &mut self, store: &NodeStore, pid: NodeId, parent_text: ResolvedTextStyle, parent_rtl: bool, interaction: Option<&InteractionTracker>, responsive: Option<ResponsiveTextEnv<'_>>, ) -> (bool, bool)

Unconditionally recompiles paragraph root pid (e.g. after its responsive environment changed). Returns (layout_changed, paint_changed).

Source

pub fn sync_interaction_dirty( &mut self, store: &NodeStore, interaction: &InteractionTracker, dirty_nodes: &[NodeId], responsive: Option<ResponsiveTextEnv<'_>>, ) -> (&[NodeId], &[NodeId])

Recompiles only the paragraphs affected by interactive pseudo-state changes (:hover, :active, :focus, :disabled) in O(dirty * runs) with 0 tree walks and 0 allocations.

Source§

impl ParagraphStore

Source

pub fn new() -> Self

Source

pub fn reset(&mut self)

Source

pub fn ensure_capacity(&mut self, cap: usize)

Source

pub fn node_to_paragraph_slice(&self) -> &[u32]

Source

pub fn spans(&self) -> &[NvParagraphSpan]

Source

pub fn runs_slab(&self) -> &[NvTextRun]

Source

pub fn text_slab(&self) -> &[u8] ⓘ

Source

pub fn paragraph_slot(&self, id: NodeId) -> Option<u32>

O(1) indexed lookup returning the compact paragraph slot for paragraph root id.

Source

pub fn paragraph_of(&self, id: NodeId) -> Option<&NvParagraphSpan>

O(1) indexed lookup returning the compact NvParagraphSpan for paragraph root id.

Source

pub fn owner_paragraph(&self, id: NodeId) -> Option<NodeId>

O(1) lift from any inline descendant id (at arbitrary nesting depth) to its owning paragraph root NodeId (None for box nodes).

Source

pub fn layout_hash(&self, id: NodeId) -> Option<u64>

Source

pub fn paint_hash(&self, id: NodeId) -> Option<u64>

Source

pub fn paragraph_runs_slice(&self, id: NodeId) -> &[NvTextRun]

Source

pub fn paragraph_text_str<'a>( &'a self, store: &'a NodeStore, id: NodeId, ) -> Option<&'a str>

Resolves the contiguous UTF-8 text of paragraph root id (zero-copy from either store.text_slab() for 1-run paragraphs or self.text for multi-run paragraphs).

Source

pub fn paragraph_view<'a>( &'a self, store: &'a NodeStore, id: NodeId, ) -> Option<NvTextParagraphView>

Builds a zero-copy NvTextParagraphView for paragraph root id.

Source

pub fn paragraph_view_by_slot<'a>( &'a self, store: &'a NodeStore, slot: u32, ) -> Option<NvTextParagraphView>

Builds a zero-copy NvTextParagraphView directly from compact slot.

Source

pub fn dirty_layout_paragraphs(&self) -> &[NodeId]

Source

pub fn dirty_paint_paragraphs(&self) -> &[NodeId]

Source

pub fn box_to_inline_transitions(&self) -> &[NodeId]

Source

pub fn inline_to_box_transitions(&self) -> &[NodeId]

Trait Implementations§

Source§

impl Clone for ParagraphStore

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ParagraphStore

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for ParagraphStore

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.