Struct ImeRequestData
#[non_exhaustive]pub struct ImeRequestData {
pub hint_and_purpose: Option<(ImeHint, ImePurpose)>,
pub cursor_area: Option<(Position, Size)>,
pub surrounding_text: Option<ImeSurroundingText>,
}Expand description
The ImeRequest data to communicate to system’s IME.
This applies multiple IME state properties at once.
Fields set to None are not updated and the previously sent
value is reused.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.hint_and_purpose: Option<(ImeHint, ImePurpose)>Text input hint and purpose.
To support updating it, enable ImeCapabilities::hint_and_purpose().
cursor_area: Option<(Position, Size)>The IME cursor area which should not be covered by the input method popup.
To support updating it, enable ImeCapabilities::cursor_area().
surrounding_text: Option<ImeSurroundingText>The text surrounding the caret
To support updating it, enable ImeCapabilities::surrounding_text().
Implementations§
§impl ImeRequestData
impl ImeRequestData
pub fn with_hint_and_purpose(
self,
hint: ImeHint,
purpose: ImePurpose,
) -> ImeRequestData
pub fn with_hint_and_purpose( self, hint: ImeHint, purpose: ImePurpose, ) -> ImeRequestData
Sets the hint and purpose of the current text input content.
pub fn with_cursor_area(self, position: Position, size: Size) -> ImeRequestData
pub fn with_cursor_area(self, position: Position, size: Size) -> ImeRequestData
Sets the IME cursor editing area.
The position is the top left corner of that area
in surface coordinates and size is the size of this area starting from the position. An
example of such area could be a input field in the UI or line in the editor.
The windowing system could place a candidate box close to that area, but try to not obscure the specified area, so the user input to it stays visible.
The candidate box is the window / popup / overlay that allows you to select the desired characters. The look of this box may differ between input devices, even on the same platform.
(Apple’s official term is “candidate window”, see their chinese and japanese guides).
§Example
// Specify the position in logical dimensions like this:
let ime_request_data = ime_request_data.with_cursor_area(
LogicalPosition::new(400.0, 200.0).into(),
LogicalSize::new(100, 100).into(),
);
// Or specify the position in physical dimensions like this:
let ime_request_data = ime_request_data.with_cursor_area(
PhysicalPosition::new(400, 200).into(),
PhysicalSize::new(100, 100).into(),
);§Platform-specific
- iOS / Android / Web / Orbital: Unsupported.
pub fn with_surrounding_text(
self,
surrounding_text: ImeSurroundingText,
) -> ImeRequestData
pub fn with_surrounding_text( self, surrounding_text: ImeSurroundingText, ) -> ImeRequestData
Describes the text surrounding the caret.
The IME can then continue providing suggestions for the continuation of the existing text, as well as can erase text more accurately, for example glyphs composed of multiple code points.
Trait Implementations§
§impl Clone for ImeRequestData
impl Clone for ImeRequestData
§fn clone(&self) -> ImeRequestData
fn clone(&self) -> ImeRequestData
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more§impl Debug for ImeRequestData
impl Debug for ImeRequestData
§impl Default for ImeRequestData
impl Default for ImeRequestData
§fn default() -> ImeRequestData
fn default() -> ImeRequestData
§impl PartialEq for ImeRequestData
impl PartialEq for ImeRequestData
impl StructuralPartialEq for ImeRequestData
Auto Trait Implementations§
impl Freeze for ImeRequestData
impl RefUnwindSafe for ImeRequestData
impl Send for ImeRequestData
impl Sync for ImeRequestData
impl Unpin for ImeRequestData
impl UnwindSafe for ImeRequestData
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.