Skip to main content

Mode

Struct Mode 

Source
#[repr(C)]
pub struct Mode {
Show 23 fields pub abi_version: c_uint, pub name: *mut c_char, pub cfg_name_key: [c_char; 128], pub display_name: *mut c_char, pub _init: ModeInit, pub _destroy: ModeDestroy, pub _get_num_entries: ModeGetNumEntries, pub _result: ModeResult, pub _token_match: ModeTokenMatch, pub _get_display_value: ModeGetDisplayValue, pub _get_icon: ModeGetIcon, pub _get_completion: ModeGetCompletion, pub _preprocess_input: ModePreprocessInput, pub _get_message: ModeGetMessage, pub private_data: *mut c_void, pub free: ModeFree, pub _create: ModeCreate, pub _completer_result: ModeCompleterResult, pub ed: *mut c_void, pub module: *mut GModule, pub fallback_icon_fetch_uid: u32, pub fallback_icon_not_found: u32, pub type: ModeType,
}
Expand description

Structure defining a switcher.

Access should be done through mode_* functions, not the function pointer fields on this type.

It consists of a name, callback and if enabled a textbox for the sidebar-mode.

Fields§

§abi_version: c_uint

Used for external plugins.

You should set this to ABI_VERSION.

§name: *mut c_char

Name (max 31 char long)

§cfg_name_key: [c_char; 128]§display_name: *mut c_char§_init: ModeInit

Initialize the Mode.

Returns true if successful.

§_destroy: ModeDestroy

Destroy the switcher, e.g. free all its memory. Still ready to restart.

§_get_num_entries: ModeGetNumEntries

Get the number of entries to display (unfiltered).

§_result: ModeResult

Process the result of the user selection.

§_token_match: ModeTokenMatch

Token match for the matching algorithm.

§_get_display_value: ModeGetDisplayValue

Get the string to display for the entry.

§_get_icon: ModeGetIcon

Obtains the icon of the entry if available.

§_get_completion: ModeGetCompletion

Obtains the string to complete.

§_preprocess_input: ModePreprocessInput

Preprocess the input for sorting.

§_get_message: ModeGetMessage

Message to show in the message bar.

§private_data: *mut c_void

Pointer to private data.

§free: ModeFree

Free the switcher.

§_create: ModeCreate

Create mode.

§_completer_result: ModeCompleterResult

If this mode is used as a completer.

§ed: *mut c_void

Extra fields for the script.

§module: *mut GModule

Module

§fallback_icon_fetch_uid: u32

Fallback icon

§fallback_icon_not_found: u32

Fallback icon

§type: ModeType

Type.

Implementations§

Source§

impl Mode

Source

pub const fn default() -> Self

Create a Mode with all None/null fields.

Trait Implementations§

Source§

impl Clone for Mode

Source§

fn clone(&self) -> Mode

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Mode

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Mode

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Copy for Mode

Source§

impl Sync for Mode

Auto Trait Implementations§

§

impl Freeze for Mode

§

impl RefUnwindSafe for Mode

§

impl !Send for Mode

§

impl Unpin for Mode

§

impl UnsafeUnpin for Mode

§

impl UnwindSafe for Mode

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.