Skip to main content

NativeDocumentSession

Struct NativeDocumentSession 

Source
pub struct NativeDocumentSession { /* private fields */ }

Implementations§

Source§

impl NativeDocumentSession

Source

pub fn accessibility_snapshot( &self, request: &NativeAccessibilityRequest, selection: Option<&NativeTextSelection>, ) -> Result<NativeAccessibilitySnapshot, NativeHostError>

Read body/table text with bounded nodes, UTF-8 bytes, descent and visited items. No document edits, selection changes, or revision changes occur. The optional selection must address bounded (<=1 MiB) paragraphs. Geometry is optional and its unsupported/unavailable/budget states remain explicit. Selection metadata is session-wide, even when a structural range is given.

Source§

impl NativeDocumentSession

Source

pub fn font_state(&self) -> &NativeFontState

Source

pub fn set_font_sources( &mut self, paths: &[PathBuf], environment: Option<FontEnvironment>, ) -> Result<bool, NativeHostError>

Replace explicit TTF/OTF/TTC files and the layout declaration atomically.

Files must be regular, nonempty and within the public limits above. Every collection face must parse and load; retained per-face copies are also bounded to 64 MiB. No directory or environment-path search is performed. Symlinks to regular files are accepted. The pre-open metadata check avoids ordinary FIFO blocking, but is not an adversarial filesystem race guard.

Bytes are read once with a bounded reader and supplied directly to Skia. Later file changes cannot mutate this snapshot. Identical ordered contents and declaration return false, even at new paths. A successful change advances only font_generation, leaving document revision/dirty unchanged. Any ordinary error preserves the previous renderer, state and declaration. Without native-skia this returns FeatureDisabled before opening any file.

Source§

impl NativeDocumentSession

Source§

impl NativeDocumentSession

Source

pub fn is_dirty(&self) -> bool

New/from_core sessions are unsaved. open_bytes starts at a saved revision.

Source

pub fn prepare_save( &mut self, format: NativeSaveFormat, ) -> Result<PreparedSave, NativeHostError>

Preserve the core’s current stored caret. NativeEditor supplies its view selection through prepare_save_with_caret instead.

Source

pub fn prepare_save_with_caret( &mut self, format: NativeSaveFormat, focus: &NativeTextPosition, ) -> Result<PreparedSave, NativeHostError>

Stamp a validated body focus only in the final export snapshot. The live core, its stored caret, revision, history and pending checkpoint are not modified if validation or serialization fails. Inline affinity/cells are intentionally outside this initial saved-caret contract. HWPX does not consume the core caret: use prepare_save(Hwpx) to preserve its existing source-settings policy without claiming the current focus was saved.

Source

pub fn acknowledge_save( &mut self, token: NativeSaveToken, ) -> Result<NativeSaveStatus, NativeHostError>

Confirm host persistence of the latest prepared bytes. A delayed success records the revision actually written, leaving any newer revision dirty.

Source

pub fn cancel_save( &mut self, token: NativeSaveToken, ) -> Result<NativeSaveStatus, NativeHostError>

Abandon a failed/cancelled write without changing the saved revision.

Source§

impl NativeDocumentSession

Source

pub fn from_core(core: DocumentCore) -> Self

Source

pub fn new_blank() -> Result<Self, NativeHostError>

Source

pub fn open_bytes( bytes: &[u8], password: Option<&[u8]>, ) -> Result<Self, NativeHostError>

Source

pub fn open_recovery_bytes(bytes: &[u8]) -> Result<Self, NativeHostError>

Open an explicitly chosen recovery payload as an unsaved document. The recovery artifact is not a user save checkpoint or a source path.

Source

pub fn document(&self) -> &DocumentCore

Source

pub fn revision(&self) -> u64

Source

pub fn font_generation(&self) -> u64

Source

pub fn is_frame_current(&self, revision: u64, font_generation: u64) -> bool

Source

pub fn clear_caches(&self)

Source

pub fn check_revision(&self, expected: u64) -> Result<(), NativeHostError>

Source

pub fn page_size(&self, page: u32) -> Result<NativePageSize, NativeHostError>

Source

pub fn render_page( &self, page: u32, scale: f64, ) -> Result<NativeFrame, NativeHostError>

Source

pub fn render_region( &self, page: u32, region: RasterRegion, scale: f64, ) -> Result<NativeFrame, NativeHostError>

Source

pub fn render_tiled_region( &self, page: u32, region: RasterRegion, scale: f64, ) -> Result<NativeFrame, NativeHostError>

Opt-in fixed-grid rendering for large pages and high scales. The full-page exact-crop API remains available through render_region.

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> Finish for T

Source§

fn finish(self)

Does nothing but move self, equivalent to drop.
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<U, T> ToOwnedObj<U> for T
where U: FromObjRef<T>,

Source§

fn to_owned_obj(&self, data: FontData<'_>) -> U

Convert this type into T, using the provided data to resolve any offsets.
Source§

impl<U, T> ToOwnedTable<U> for T
where U: FromTableRef<T>,

Source§

fn to_owned_table(&self) -> U

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.
Source§

impl<S, T> Upcast<T> for S
where T: UpcastFrom<S> + ?Sized, S: ?Sized,

Source§

fn upcast(&self) -> &T
where Self: ErasableGeneric, T: Sized + ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider ref type within the Wasm bindgen generics type system. Read more
Source§

fn upcast_into(self) -> T
where Self: Sized + ErasableGeneric, T: Sized + ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider type within the Wasm bindgen generics type system. Read more