pub struct WindowImeSurroundingText {
pub text: Arc<str>,
pub cursor: u32,
pub anchor: u32,
}Expand description
Best-effort IME surrounding text excerpt.
This is intended for platform bridges that need “text around caret” semantics (e.g. winit’s
ImeSurroundingText).
textMUST exclude any active preedit/composing text.cursor/anchorare UTF-8 byte offsets withintext(must be on char boundaries).textSHOULD be limited to at most 4000 bytes (winit backend constraint).
Fields§
§text: Arc<str>§cursor: u32§anchor: u32Implementations§
Source§impl WindowImeSurroundingText
impl WindowImeSurroundingText
pub const MAX_TEXT_BYTES: usize = 4000
Sourcepub fn best_effort_for_str(text: &str, cursor: usize, anchor: usize) -> Self
pub fn best_effort_for_str(text: &str, cursor: usize, anchor: usize) -> Self
Create a best-effort surrounding text excerpt from a full base-buffer string.
The returned excerpt is bounded to Self::MAX_TEXT_BYTES and the cursor/anchor offsets
are relative to the excerpt (UTF-8 bytes).
Trait Implementations§
Source§impl Clone for WindowImeSurroundingText
impl Clone for WindowImeSurroundingText
Source§fn clone(&self) -> WindowImeSurroundingText
fn clone(&self) -> WindowImeSurroundingText
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for WindowImeSurroundingText
impl Debug for WindowImeSurroundingText
Source§impl Hash for WindowImeSurroundingText
impl Hash for WindowImeSurroundingText
Source§impl PartialEq for WindowImeSurroundingText
impl PartialEq for WindowImeSurroundingText
impl Eq for WindowImeSurroundingText
impl StructuralPartialEq for WindowImeSurroundingText
Auto Trait Implementations§
impl Freeze for WindowImeSurroundingText
impl RefUnwindSafe for WindowImeSurroundingText
impl Send for WindowImeSurroundingText
impl Sync for WindowImeSurroundingText
impl Unpin for WindowImeSurroundingText
impl UnsafeUnpin for WindowImeSurroundingText
impl UnwindSafe for WindowImeSurroundingText
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
Mutably borrows from an owned value. Read more