TextInputMethodRangeGeometry
struct · ferroui-base · v0.5.0
struct TextInputMethodRangeGeometry
Complete geometry for one ordered UTF-16 range of the currently displayed input story, including any visible composition preview.
The fragments are immutable; an empty range describes the requested insertion position. A nonempty range can span shaped clusters, bidi runs, lines or linked views. No fragment is a candidate-window rectangle.
Layout and native property getters can invoke application code. Adapters
must call is_current after callbacks and before each
native publication, in addition to checking their input-session ownership.
A snapshot never authorizes an edit or keeps an input connection current.
Members
new
fn new(range: TextSelection, fragments: impl Into<Rc<[TextInputMethodTextBounds]>>, is_current: impl Fn() -> bool + 'static) -> Result<Self, TextInputMethodError>
Creates a snapshot with a client-supplied validity check. The check must be observational and detect document, layout, scrolling and view changes not already represented by the framework's visual geometry version. Capture weak references so a retained result cannot retain its control.
Empty fragments mean geometry is unavailable, not a request to use the current caret. Zero-width fragments are valid for line/paragraph breaks.
range
fn range(self: &Self) -> TextSelection
fragments
fn fragments(self: &Self) -> &[TextInputMethodTextBounds]
is_current
fn is_current(self: &Self) -> bool
Checks both client layout state and synchronous visual changes. The second version check also rejects a visual change made by the callback. The caller must still recheck its own generation after this client call.
Trait implementations
SendSyncFreezeUnsafeUnpinUnpinUnwindSafeRefUnwindSafeClassDefaultsBorrow<T>BorrowMut<T>CloneToUninitInto<U>From<T>TryInto<U>TryFrom<U>AnyToOwnedErasedDestructorIntoEitherCloneDebug
Availability
Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.