API reference

aster_ui::editing

Pre-1.0: signatures are not frozen. Generated from rustdoc JSON of the compiled crate; rustdoc JSON format version 60. Only public items are listed.

Revision-admitted editing using one existing document and field controller.

This is an editing bridge, not a widget, router, OS clipboard or IME session. Every command must match the facade document's full owner/revision. The native host must separately validate its actual acknowledged field/focus. Password policy suppresses copy/cut exposure. Paste remains separately admitted by the existing writable-field and revision guards. This does not provide masking, memory erasure or secret-safe snapshots/presentation.

Structs

structaster_ui::editing::ClipboardIntent

pub struct ClipboardIntent { /* see fields */ }

Caller-owned, value-free clipboard intent. It is not Clone or Copy. Consume it on completion; retire it on focus loss, cancellation or field replacement. Existing document revision and backend cut guards are reused.

Methods

  • fn kind(&self) -> ClipboardKind

Trait implementations: Debug

structaster_ui::editing::FieldEditor

pub struct FieldEditor { /* see fields */ }

Owner-thread field defaults over the original typed facade document. No document clone, public raw-inner access, extra identity or router. The input scratch capacity and plain-document history behavior are the existing backend's. No zero-allocation or allocation-recovery claim is made.

use aster_ui::{TextDocument, editing::{Command, FieldEditor, FieldPolicy}};
let document = TextDocument::new("", 128, 64)?;
let mut field = FieldEditor::new(document, FieldPolicy::default(), 64)?;
let expected = field.document().revision();
field.edit(expected, Command::Text('a'), 0)?;
assert_eq!(field.document().source().text(), "a");

Methods

  • fn new(document: TextDocument, policy: FieldPolicy, max_input_bytes: usize) -> Result<Self, Error>
  • fn document(&self) -> &TextDocument
  • fn document_mut(&mut self) -> &mut TextDocument — Mutable access remains to the typed facade only. Its existing mutation methods require owner/revision-bound arguments; the raw core is private. Replacing this document invalidates old clipboard intents by owner.
  • fn into_document(self) -> TextDocument
  • fn policy(&self) -> FieldPolicy
  • fn set_policy(&mut self, policy: FieldPolicy) — Policy changes are application-owned. Retire outstanding host intents when focus, availability or lifetime is revoked; no ABA token is minted.
  • fn edit(&mut self, expected: DocumentRevision, command: Command<'_>, modifiers: u8) -> Result<Response, Error>
  • fn paste(&mut self, expected: DocumentRevision, text: &str) -> Result<Option<DocumentChange>, Error> — Immediate caller edit, not asynchronous clipboard admission.
  • fn clipboard_text(&self, intent: &ClipboardIntent) -> Result<Option<&str>, Error> — Read selected text only for an exact current copy/cut intent and only when current policy permits it. Text is borrowed, not cached in intent.
  • fn complete_cut(&mut self, intent: ClipboardIntent) -> Result<Option<DocumentChange>, Error> — Complete only after the host's clipboard write succeeded. The existing core document ID, revision and exact selection guard still runs.
  • fn complete_paste(&mut self, intent: ClipboardIntent, text: &str) -> Result<Option<DocumentChange>, Error> — Apply a host-read paste only if the initiating editor revision is still current. Caller must also retain/check the originating field lifetime.

structaster_ui::editing::Response

pub struct Response { /* see fields */ }

Public fields

fieldtype
handledbool
changeOption<super::DocumentChange>
clipboardOption<ClipboardIntent>

Trait implementations: Debug

Enums

enumaster_ui::editing::ClipboardKind

pub enum ClipboardKind { Copy, Cut, Paste }

Clipboard work requested by a field command. This grants no OS authority.

Variants

  • Copy
  • Cut
  • Paste

Trait implementations: Clone, Copy, Debug, Eq, PartialEq, StructuralPartialEq