FerroUI/ docs

Search guides, controls, Rust APIs, and XAML.

    GitHub ↗

    Document

    struct · ferroui-designer-core · v0.5.0

    struct Document
    

    An owned source buffer with a last-valid syntax snapshot and bounded history. Runtime acceptance is deliberately separate: the host may keep an older live tree when compilation fails, while authored and syntactically valid XAML stays available for correction.

    View source

    Members

    new

    fn new(source: impl Into<String>) -> Result<Self, DesignerError>
    

    Source

    source

    fn source(self: &Self) -> &str
    

    Source

    valid_source

    fn valid_source(self: &Self) -> &str
    

    Source

    revision

    fn revision(self: &Self) -> u64
    

    Source

    snapshot_without_history

    fn snapshot_without_history(self: &Self) -> Self
    

    Capture the exact current buffer, accepted syntax identity and saved state without copying its undo/redo history. Preview hosts can retain this cheap snapshot without retaining every authoring transaction. Subsequent edits to either document are independent; new edits use the same history limit.

    Source

    advance_revision_to

    fn advance_revision_to(self: &mut Self, minimum: u64) -> Result<(), DesignerError>
    

    Rebase a restored tab onto its host's monotonic revision sequence without altering source, stable node IDs, dirty state or history. Reserve the next revision for editing.

    Source

    ast

    fn ast(self: &Self) -> &Ast
    

    Source

    ast_snapshot

    fn ast_snapshot(self: &Self) -> Arc<Ast>
    

    Share the exact immutable syntax snapshot without copying its nodes. A gesture can retain this handle together with a revision to reject a command prepared for a different document, even if its local IDs match. Invalid source returns the last-valid syntax, like ast().

    Source

    diagnostics

    fn diagnostics(self: &Self) -> &[Diagnostic]
    

    Source

    is_valid

    fn is_valid(self: &Self) -> bool
    

    Source

    is_dirty

    fn is_dirty(self: &Self) -> bool
    

    Source

    mark_saved

    fn mark_saved(self: &mut Self)
    

    Source

    mark_saved_snapshot

    fn mark_saved_snapshot(self: &mut Self, source: impl Into<String>)
    

    Acknowledge the exact snapshot written by an asynchronous storage provider. The current buffer may already contain newer edits; revision and history are unchanged.

    Source

    can_undo

    fn can_undo(self: &Self) -> bool
    

    Source

    can_redo

    fn can_redo(self: &Self) -> bool
    

    Source

    undo_label

    fn undo_label(self: &Self) -> Option<&str>
    

    Source

    redo_label

    fn redo_label(self: &Self) -> Option<&str>
    

    Source

    set_history_limit

    fn set_history_limit(self: &mut Self, limit: usize)
    

    Source

    apply

    fn apply(self: &mut Self, label: impl Into<String>, edits: Vec<Edit>) -> Result<ChangeSet, DesignerError>
    

    Source

    apply_at

    fn apply_at(self: &mut Self, expected_revision: u64, label: impl Into<String>, edits: Vec<Edit>) -> Result<ChangeSet, DesignerError>
    

    Source

    transact

    fn transact(self: &mut Self, transaction: Transaction) -> Result<ChangeSet, DesignerError>
    

    Source

    apply_text_patches

    fn apply_text_patches(self: &mut Self, expected_revision: u64, label: impl Into<String>, patches: Vec<TextPatch>) -> Result<ChangeSet, DesignerError>
    

    Apply disjoint editor patches atomically. All spans refer to the current authored source; UTF-8 boundaries and overlap are checked before mutation.

    Source

    update_source

    fn update_source(self: &mut Self, label: impl Into<String>, source: impl Into<String>) -> SourceUpdate
    

    Source editors may temporarily contain invalid XML. The raw buffer and diagnostics enter history, while the AST/preview source remain the last valid snapshot. A subsequent valid source update reconciles node IDs.

    Source

    try_update_source

    fn try_update_source(self: &mut Self, label: impl Into<String>, source: impl Into<String>) -> Result<SourceUpdate, DesignerError>
    

    Fallible source editing for hosts that must distinguish a rejected write from an accepted but temporarily invalid XML buffer. Revision exhaustion cannot alter source, node identity, history or saved-state tracking.

    Source

    update_source_at

    fn update_source_at(self: &mut Self, expected_revision: u64, label: impl Into<String>, source: impl Into<String>) -> Result<SourceUpdate, DesignerError>
    

    Source

    undo

    fn undo(self: &mut Self) -> Result<ChangeSet, DesignerError>
    

    Source

    redo

    fn redo(self: &mut Self) -> Result<ChangeSet, DesignerError>
    

    Source

    Trait implementations

    • Send
    • Sync
    • Freeze
    • UnsafeUnpin
    • Unpin
    • UnwindSafe
    • RefUnwindSafe
    • Borrow<T>
    • BorrowMut<T>
    • CloneToUninit
    • Into<U>
    • From<T>
    • TryInto<U>
    • TryFrom<U>
    • Any
    • ToOwned
    • Clone

    Availability

    Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.