Struct rm_config::keymap::KeymapConfig

source ·
pub struct KeymapConfig {
    pub general: KeybindsHolder<GeneralAction>,
    pub torrents_tab: KeybindsHolder<TorrentsAction>,
    pub search_tab: KeybindsHolder<SearchAction>,
    pub general_keymap: HashMap<(KeyCode, KeyModifiers), Action>,
    pub torrent_keymap: HashMap<(KeyCode, KeyModifiers), Action>,
    pub search_keymap: HashMap<(KeyCode, KeyModifiers), Action>,
}

Fields§

§general: KeybindsHolder<GeneralAction>§torrents_tab: KeybindsHolder<TorrentsAction>§search_tab: KeybindsHolder<SearchAction>§general_keymap: HashMap<(KeyCode, KeyModifiers), Action>§torrent_keymap: HashMap<(KeyCode, KeyModifiers), Action>§search_keymap: HashMap<(KeyCode, KeyModifiers), Action>

Implementations§

source§

impl KeymapConfig

source

pub const FILENAME: &'static str = "keymap.toml"

source

pub const DEFAULT_CONFIG: &'static str = "[general]\nkeybindings = [\n { on = \"?\", action = \"ShowHelp\", show_in_help = false },\n { on = \"F1\", action = \"ShowHelp\", show_in_help = false },\n\n { on = \"q\", action = \"Quit\" },\n { on = \"Esc\", action = \"Close\" },\n { on = \"Enter\", action = \"Confirm\" },\n { on = \" \", action = \"Select\" },\n { on = \"Tab\", action = \"SwitchFocus\" },\n { on = \"/\", action = \"Search\" },\n { on = \"o\", action = \"XdgOpen\" },\n \n { on = \"1\", action = \"SwitchToTorrents\" },\n { on = \"2\", action = \"SwitchToSearch\" },\n\n { on = \"Home\", action = \"GoToBeginning\" },\n { on = \"End\", action = \"GoToEnd\" },\n { on = \"PageUp\", action = \"ScrollPageUp\", show_in_help = false },\n { on = \"PageDown\", action = \"ScrollPageDown\", show_in_help = false },\n\n { modifier = \"Ctrl\", on = \"u\", action = \"ScrollPageUp\" },\n { modifier = \"Ctrl\", on = \"d\", action = \"ScrollPageDown\" },\n\n # Arrows\n { on = \"Left\", action = \"Left\" },\n { on = \"Right\", action = \"Right\" },\n { on = \"Up\", action = \"Up\"},\n { on = \"Down\", action = \"Down\" },\n\n # Vi\n { on = \"h\", action = \"Left\" },\n { on = \"l\", action = \"Right\" },\n { on = \"k\", action = \"Up\" },\n { on = \"j\", action = \"Down\" },\n\n # Sorting\n { on = \"H\", action = \"MoveToColumnLeft\"},\n { on = \"L\", action = \"MoveToColumnRight\"},\n]\n\n[torrents_tab]\nkeybindings = [\n { on = \"a\", action = \"AddMagnet\" },\n { on = \"m\", action = \"MoveTorrent\" },\n { on = \"c\", action = \"ChangeCategory\" },\n { on = \"p\", action = \"Pause\" },\n { on = \"f\", action = \"ShowFiles\" },\n { on = \"s\", action = \"ShowStats\" },\n\n { on = \"d\", action = \"Delete\" },\n]\n\n[search_tab]\nkeybindings = [\n { on = \"p\", action = \"ShowProvidersInfo\" }\n]\n\n"

source

pub fn init() -> Result<Self>

source

pub fn get_keys_for_action_joined(&self, action: Action) -> Option<String>

source

pub fn get_keys_for_action(&self, action: Action) -> Option<Vec<String>>

source

pub fn path() -> &'static PathBuf

Trait Implementations§

source§

impl Clone for KeymapConfig

source§

fn clone(&self) -> KeymapConfig

Returns a copy of the value. Read more
1.0.0 · source§

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

Performs copy-assignment from source. Read more
source§

impl<'de> Deserialize<'de> for KeymapConfig

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl Serialize for KeymapConfig

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

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, dst: *mut T)

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

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

source§

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 more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
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.
source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,