Struct ShortcutConfig
pub struct ShortcutConfig {
pub bindings: BTreeMap<ShortcutAction, KeyChord>,
pub actions: Vec<ActionChord>,
}Fields§
§bindings: BTreeMap<ShortcutAction, KeyChord>§actions: Vec<ActionChord>Chords bound to published actions: anything the action door offers,
a saved shortcut’s run included.
Implementations§
§impl ShortcutConfig
impl ShortcutConfig
pub fn validate(&self) -> Result<(), ShortcutConfigError>
pub fn validate(&self) -> Result<(), ShortcutConfigError>
Validate an already assembled table before it becomes live runtime
state. Unlike Self::load, this rejects rather than repairs so a
caller cannot install ambiguous ownership in a running session.
§Errors
Returns an error when a chord is invalid or reserved, or when two actions claim the same chord.
pub fn check_action_chord(
&self,
chord: &KeyChord,
target: Option<&ActionChordTarget>,
) -> Result<(), ShortcutConfigError>
pub fn check_action_chord( &self, chord: &KeyChord, target: Option<&ActionChordTarget>, ) -> Result<(), ShortcutConfigError>
Whether chord may run the published action target: a valid,
unreserved chord that is neither one of the shell’s fixed chords, nor
bound to a configurable desktop action, nor running another action.
pub fn set_action(
&mut self,
chord: KeyChord,
target: ActionChordTarget,
label: impl Into<String>,
) -> Result<(), ShortcutConfigError>
pub fn set_action( &mut self, chord: KeyChord, target: ActionChordTarget, label: impl Into<String>, ) -> Result<(), ShortcutConfigError>
Bind chord to the published action target, replacing the chord
it had.
§Errors
Why the chord cannot be bound; the table is then unchanged.
pub fn remove_action(&mut self, target: &ActionChordTarget) -> bool
pub fn remove_action(&mut self, target: &ActionChordTarget) -> bool
Unbind whatever chord runs target. false when none did.
pub fn action_for(&self, chord: &KeyChord) -> Option<&ActionChord>
pub fn action_for(&self, chord: &KeyChord) -> Option<&ActionChord>
The action chord runs, when it runs one.
pub fn set(
&mut self,
action: ShortcutAction,
chord: KeyChord,
) -> Result<(), ShortcutConfigError>
pub fn set( &mut self, action: ShortcutAction, chord: KeyChord, ) -> Result<(), ShortcutConfigError>
Move action to chord. A chord that already belongs to someone
else is refused, naming the holder, rather than taken from it.
§Errors
Returns an error without changing this binding when chord is invalid,
system-reserved, or already belongs to another action, to a fixed
desktop shortcut (other than one action shares by default), or to a
published action.
pub fn load() -> ShortcutConfig
pub fn load_in(source: &dyn SettingsSource) -> ShortcutConfig
pub fn load_in(source: &dyn SettingsSource) -> ShortcutConfig
Self::load from source.
pub fn from_section(section: Map<String, Value>) -> ShortcutConfig
pub fn from_section(section: Map<String, Value>) -> ShortcutConfig
The configuration a shortcuts section holds, repaired as
Self::normalise repairs it.
pub fn normalise(loaded: ShortcutConfig) -> ShortcutConfig
pub fn normalise(loaded: ShortcutConfig) -> ShortcutConfig
Deterministically repairs manual/corrupt persisted state: begin with defaults, then accept a stored override only when it is a valid, non-reserved, non-conflicting chord. Bad entries fall back to their default instead of leaving ambiguous client ownership.
A stored chord that was once the default for its action
(RETIRED_DEFAULTS) was saved because Self::save writes the
whole table, not because the person chose it; it yields to the
current default.
pub fn save(&self) -> Result<(), Error>
pub fn save(&self) -> Result<(), Error>
§Errors
Returns an error if self can’t be serialised or the section can’t
be written.
pub fn save_in(&self, source: &dyn SettingsSource) -> Result<(), Error>
pub fn save_in(&self, source: &dyn SettingsSource) -> Result<(), Error>
Self::save into source.
§impl ShortcutConfig
impl ShortcutConfig
pub fn reset(
&mut self,
action: ShortcutAction,
) -> Result<(), ShortcutConfigError>
pub fn reset( &mut self, action: ShortcutAction, ) -> Result<(), ShortcutConfigError>
Trait Implementations§
§impl Clone for ShortcutConfig
impl Clone for ShortcutConfig
§fn clone(&self) -> ShortcutConfig
fn clone(&self) -> ShortcutConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more§impl Debug for ShortcutConfig
impl Debug for ShortcutConfig
§impl Default for ShortcutConfig
impl Default for ShortcutConfig
§fn default() -> ShortcutConfig
fn default() -> ShortcutConfig
§impl<'de> Deserialize<'de> for ShortcutConfigwhere
ShortcutConfig: Default,
impl<'de> Deserialize<'de> for ShortcutConfigwhere
ShortcutConfig: Default,
§fn deserialize<__D>(
__deserializer: __D,
) -> Result<ShortcutConfig, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<ShortcutConfig, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
§impl PartialEq for ShortcutConfig
impl PartialEq for ShortcutConfig
§impl Serialize for ShortcutConfig
impl Serialize for ShortcutConfig
§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl Eq for ShortcutConfig
impl StructuralPartialEq for ShortcutConfig
Auto Trait Implementations§
impl Freeze for ShortcutConfig
impl RefUnwindSafe for ShortcutConfig
impl Send for ShortcutConfig
impl Sync for ShortcutConfig
impl Unpin for ShortcutConfig
impl UnsafeUnpin for ShortcutConfig
impl UnwindSafe for ShortcutConfig
Blanket Implementations§
§impl<T> AnyEq for T
impl<T> AnyEq for T
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§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>
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>
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)
&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)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§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>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn 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>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which 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)
&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)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSend for T
impl<T> DowncastSend for T
§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§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<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>
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>
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