Enum InputMethod
pub enum InputMethod<T = String> {
Disabled,
Enabled {
cursor: Rectangle,
purpose: Purpose,
preedit: Option<Preedit<T>>,
},
}Available on crate feature
advanced only.Expand description
The input method strategy of a widget.
Variants§
Disabled
Input method is disabled.
Enabled
Input method is enabled.
Fields
§
preedit: Option<Preedit<T>>The preedit to overlay on top of the input method dialog, if needed.
Ideally, your widget will show pre-edits on-the-spot; but, since that can be tricky, you can instead provide the current pre-edit here and the runtime will display it as an overlay (i.e. “Over-the-spot IME”).
Implementations§
§impl InputMethod
impl InputMethod
pub fn merge<T>(&mut self, other: &InputMethod<T>)
pub fn merge<T>(&mut self, other: &InputMethod<T>)
Merges two InputMethod strategies, prioritizing the first one when both open:
let open = InputMethod::Enabled {
cursor: Rectangle::new(Point::ORIGIN, Size::UNIT),
purpose: Purpose::Normal,
preedit: Some(Preedit { content: "1".to_owned(), selection: None, text_size: None }),
};
let open_2 = InputMethod::Enabled {
cursor: Rectangle::new(Point::ORIGIN, Size::UNIT),
purpose: Purpose::Secure,
preedit: Some(Preedit { content: "2".to_owned(), selection: None, text_size: None }),
};
let mut ime = InputMethod::Disabled;
ime.merge(&open);
assert_eq!(ime, open);
ime.merge(&open_2);
assert_eq!(ime, open);pub fn is_enabled(&self) -> bool
pub fn is_enabled(&self) -> bool
Returns true if the InputMethod is open.
§impl<T> InputMethod<T>
impl<T> InputMethod<T>
pub fn to_owned(&self) -> InputMethod
pub fn to_owned(&self) -> InputMethod
Turns an InputMethod into its owned version.
Trait Implementations§
§impl<T> Clone for InputMethod<T>where
T: Clone,
impl<T> Clone for InputMethod<T>where
T: Clone,
§fn clone(&self) -> InputMethod<T>
fn clone(&self) -> InputMethod<T>
Returns a duplicate of the value. Read more
1.0.0§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read more§impl<T> Debug for InputMethod<T>where
T: Debug,
impl<T> Debug for InputMethod<T>where
T: Debug,
§impl<T> PartialEq for InputMethod<T>where
T: PartialEq,
impl<T> PartialEq for InputMethod<T>where
T: PartialEq,
impl<T> StructuralPartialEq for InputMethod<T>
Auto Trait Implementations§
impl<T> Freeze for InputMethod<T>where
T: Freeze,
impl<T> RefUnwindSafe for InputMethod<T>where
T: RefUnwindSafe,
impl<T> Send for InputMethod<T>where
T: Send,
impl<T> Sync for InputMethod<T>where
T: Sync,
impl<T> Unpin for InputMethod<T>where
T: Unpin,
impl<T> UnwindSafe for InputMethod<T>where
T: UnwindSafe,
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit)§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>
Convert
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>
Convert
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)
Convert
&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)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<State, Message> IntoBoot<State, Message> for State
impl<State, Message> IntoBoot<State, Message> for State
Source§fn into_boot(self) -> (State, Task<Message>)
fn into_boot(self) -> (State, Task<Message>)
Turns some type into the initial state of some
Application.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more