#[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§
Source§impl ImeRequestData
impl ImeRequestData
Sourcepub fn with_hint_and_purpose(self, hint: ImeHint, purpose: ImePurpose) -> Self
pub fn with_hint_and_purpose(self, hint: ImeHint, purpose: ImePurpose) -> Self
Sets the hint and purpose of the current text input content.
Sourcepub fn with_cursor_area(self, position: Position, size: Size) -> Self
pub fn with_cursor_area(self, position: Position, size: Size) -> Self
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.
Sourcepub fn with_surrounding_text(self, surrounding_text: ImeSurroundingText) -> Self
pub fn with_surrounding_text(self, surrounding_text: ImeSurroundingText) -> Self
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.