pub struct NativeDocumentSession { /* private fields */ }Implementations§
Source§impl NativeDocumentSession
impl NativeDocumentSession
Sourcepub fn accessibility_snapshot(
&self,
request: &NativeAccessibilityRequest,
selection: Option<&NativeTextSelection>,
) -> Result<NativeAccessibilitySnapshot, NativeHostError>
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
impl NativeDocumentSession
pub fn font_state(&self) -> &NativeFontState
Sourcepub fn set_font_sources(
&mut self,
paths: &[PathBuf],
environment: Option<FontEnvironment>,
) -> Result<bool, NativeHostError>
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
impl NativeDocumentSession
pub fn render_snapshot( &self, page: u32, profile: RenderProfile, ) -> Result<NativeRenderSnapshot, NativeHostError>
pub fn render_snapshot_with_limits( &self, page: u32, profile: RenderProfile, limits: NativeRenderSnapshotLimits, ) -> Result<NativeRenderSnapshot, NativeHostError>
Source§impl NativeDocumentSession
impl NativeDocumentSession
Sourcepub fn is_dirty(&self) -> bool
pub fn is_dirty(&self) -> bool
New/from_core sessions are unsaved. open_bytes starts at a saved revision.
Sourcepub fn prepare_save(
&mut self,
format: NativeSaveFormat,
) -> Result<PreparedSave, NativeHostError>
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.
Sourcepub fn prepare_save_with_caret(
&mut self,
format: NativeSaveFormat,
focus: &NativeTextPosition,
) -> Result<PreparedSave, NativeHostError>
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.
Sourcepub fn acknowledge_save(
&mut self,
token: NativeSaveToken,
) -> Result<NativeSaveStatus, NativeHostError>
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.
Sourcepub fn cancel_save(
&mut self,
token: NativeSaveToken,
) -> Result<NativeSaveStatus, NativeHostError>
pub fn cancel_save( &mut self, token: NativeSaveToken, ) -> Result<NativeSaveStatus, NativeHostError>
Abandon a failed/cancelled write without changing the saved revision.
Source§impl NativeDocumentSession
impl NativeDocumentSession
pub fn from_core(core: DocumentCore) -> Self
pub fn new_blank() -> Result<Self, NativeHostError>
pub fn open_bytes( bytes: &[u8], password: Option<&[u8]>, ) -> Result<Self, NativeHostError>
Sourcepub fn open_recovery_bytes(bytes: &[u8]) -> Result<Self, NativeHostError>
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.
pub fn document(&self) -> &DocumentCore
pub fn revision(&self) -> u64
pub fn font_generation(&self) -> u64
pub fn is_frame_current(&self, revision: u64, font_generation: u64) -> bool
pub fn clear_caches(&self)
pub fn check_revision(&self, expected: u64) -> Result<(), NativeHostError>
pub fn page_size(&self, page: u32) -> Result<NativePageSize, NativeHostError>
pub fn render_page( &self, page: u32, scale: f64, ) -> Result<NativeFrame, NativeHostError>
pub fn render_region( &self, page: u32, region: RasterRegion, scale: f64, ) -> Result<NativeFrame, NativeHostError>
Sourcepub fn render_tiled_region(
&self,
page: u32,
region: RasterRegion,
scale: f64,
) -> Result<NativeFrame, NativeHostError>
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§
impl !Freeze for NativeDocumentSession
impl !RefUnwindSafe for NativeDocumentSession
impl !Send for NativeDocumentSession
impl !Sync for NativeDocumentSession
impl !UnwindSafe for NativeDocumentSession
impl Forget for NativeDocumentSession
impl Move for NativeDocumentSession
impl Unpin for NativeDocumentSession
impl UnsafeUnpin for NativeDocumentSession
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<U, T> ToOwnedObj<U> for Twhere
U: FromObjRef<T>,
impl<U, T> ToOwnedObj<U> for Twhere
U: FromObjRef<T>,
Source§fn to_owned_obj(&self, data: FontData<'_>) -> U
fn to_owned_obj(&self, data: FontData<'_>) -> U
T, using the provided data to resolve any offsets.