pub struct ContextMenu {
pub rules: Vec<ContextRule>,
}Expand description
Configurable per-row context menus.
With no configuration the built-in rules produce the classic menu; the built-in defaults are listed below so users can copy and adapt them.
Fields§
§rules: Vec<ContextRule>Implementations§
Source§impl ContextMenu
impl ContextMenu
Sourcepub fn fallback_actions(path: &Path) -> Vec<ContextAction>
pub fn fallback_actions(path: &Path) -> Vec<ContextAction>
The menu for a row no rule claims. Sourced from the first dir/fallback
rule of the shipped default (so default-config.toml also decides the
fallback); an empty menu when neither is present.
Sourcepub fn actions_for(&self, path: &Path) -> Vec<ContextAction>
pub fn actions_for(&self, path: &Path) -> Vec<ContextAction>
The menu actions for path, in display order.
Resolution is top-down over Self::rules; the first rule with at
least one claimed matcher provides the whole menu. Rows no rule claims
get Self::fallback_actions.
Sourcepub fn actions_for_selection(
&self,
path: &Path,
selection_len: usize,
) -> Vec<ContextAction>
pub fn actions_for_selection( &self, path: &Path, selection_len: usize, ) -> Vec<ContextAction>
The menu actions for a context menu opened over the given selection.
When more than one row is selected the first rule carrying the
Multi matcher provides the whole menu (so a
multi rule takes precedence over the per-path rules). For a single
selection this is exactly Self::actions_for.
Sourcepub fn shortcuts(&self) -> Vec<(String, ShortcutTarget)>
pub fn shortcuts(&self) -> Vec<(String, ShortcutTarget)>
Every configured shortcut, in rule order, deduplicated (first wins).
These drive the tree’s keyboard handling: while the tree is focused, a pressed key fires the bound action against the row under the cursor. Shortcuts are collected from all rules (not just the one that claims the current row), so a shortcut stays live wherever its action is reachable in some menu.
Trait Implementations§
Source§impl Clone for ContextMenu
impl Clone for ContextMenu
Source§impl Debug for ContextMenu
impl Debug for ContextMenu
Source§impl Default for ContextMenu
impl Default for ContextMenu
Source§impl<'de> Deserialize<'de> for ContextMenu
impl<'de> Deserialize<'de> for ContextMenu
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for ContextMenu
Source§impl PartialEq for ContextMenu
impl PartialEq for ContextMenu
Source§impl Serialize for ContextMenu
impl Serialize for ContextMenu
impl StructuralPartialEq for ContextMenu
Auto Trait Implementations§
impl Freeze for ContextMenu
impl RefUnwindSafe for ContextMenu
impl Send for ContextMenu
impl Sync for ContextMenu
impl Unpin for ContextMenu
impl UnsafeUnpin for ContextMenu
impl UnwindSafe for ContextMenu
Blanket Implementations§
Source§impl<C> AsyncPosition<()> for C
impl<C> AsyncPosition<()> for C
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> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§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