Trait InputMethod

Source
pub trait InputMethod<T: IMVisibility + HintPurpose, D: ReceiveSurroundingText> {
    // Required methods
    fn new(
        seat: &WlSeat,
        im_manager: Main<ZwpInputMethodManagerV2>,
        ui_connector: T,
        content_connector: D,
    ) -> Self;
    fn commit_string(&self, text: String) -> Result<(), SubmitError>;
    fn delete_surrounding_text(
        &self,
        before: usize,
        after: usize,
    ) -> Result<(), SubmitError>;
    fn commit(&self) -> Result<(), SubmitError>;
    fn is_active(&self) -> bool;
    fn get_surrounding_text(&self) -> (String, String);
}
Expand description

All input methods must be able to handle these functions This helps write test cases, because they can be generic

Required Methods§

Source

fn new( seat: &WlSeat, im_manager: Main<ZwpInputMethodManagerV2>, ui_connector: T, content_connector: D, ) -> Self

Create a new InputMethod. The connectors must implement the traits IMVisibility and HintPurpose

Source

fn commit_string(&self, text: String) -> Result<(), SubmitError>

Sends a ‘commit_string’ request to the wayland-server

INPUTS:

text -> Text that will be committed

Source

fn delete_surrounding_text( &self, before: usize, after: usize, ) -> Result<(), SubmitError>

Sends a ‘delete_surrounding_text’ request to the wayland server

INPUTS:

before -> number of chars to delete from the surrounding_text going left from the cursor

after -> number of chars to delete from the surrounding_text going right from the cursor

Source

fn commit(&self) -> Result<(), SubmitError>

Sends a ‘commit’ request to the wayland server

This makes the pending changes permanent

Source

fn is_active(&self) -> bool

Returns if the input method is currently active

Source

fn get_surrounding_text(&self) -> (String, String)

Returns a tuple of the current strings left and right of the cursor

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§