Skip to content

Commit

Permalink
docs: document Keybindings
Browse files Browse the repository at this point in the history
  • Loading branch information
Valentin271 committed Jan 26, 2024
1 parent eac6b3b commit 0bff8d4
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/keybindings/keybindings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@ use crate::opts::KeybindingsSection;

use super::{action::Action, KeyCombo};

/// A list of [`keybindings`](KeyCombo) each associated with an [`Action`].
#[derive(Debug, Clone, Deserialize, PartialEq, Eq)]
pub struct Keybindings(Vec<(Action, KeyCombo)>);

impl Keybindings {
/// Returns an iterator over the [`Action`]s and [`KeyCombo`]s
pub fn iter(&self) -> std::slice::Iter<'_, (Action, KeyCombo)> {
self.0.iter()
}
Expand Down Expand Up @@ -35,6 +37,10 @@ impl Default for Keybindings {
}

impl From<KeybindingsSection> for Keybindings {
/// Converts from [`KeybindingsSection`] to [`Keybindings`].
///
/// If an `extra` keybinding collides with a `base` one, then the `base` one is dropped in
/// favor of the `extra` keybinding
fn from(value: KeybindingsSection) -> Self {
let mut base = value.base;

Expand Down

0 comments on commit 0bff8d4

Please sign in to comment.