pub struct ActionInvocation { /* private fields */ }Expand description
A request for the application to run an action.
Invocation is the handoff point between a UI surface and application-owned dispatch. The action crate does not execute callbacks or mutate application state.
Use new for actions without arguments and with_args when a
UI surface has collected inputs. Dispatch code usually reads id,
args, and source.
§Examples
use ratatui_action::id::InputId;
use ratatui_action::invocation::{ActionArgs, ActionInvocation, InvocationSource};
let mut args = ActionArgs::new();
args.insert(InputId::new("theme"), "github-dark");
let invocation = ActionInvocation::with_args("theme.switch", args, InvocationSource::Palette);
assert_eq!(invocation.id().as_str(), "theme.switch");
assert_eq!(invocation.source(), InvocationSource::Palette);Implementations§
Source§impl ActionInvocation
impl ActionInvocation
Sourcepub fn new(id: impl Into<ActionId>, source: InvocationSource) -> Self
pub fn new(id: impl Into<ActionId>, source: InvocationSource) -> Self
Creates an invocation with no arguments.
Sourcepub fn with_args(
id: impl Into<ActionId>,
args: ActionArgs,
source: InvocationSource,
) -> Self
pub fn with_args( id: impl Into<ActionId>, args: ActionArgs, source: InvocationSource, ) -> Self
Creates an invocation with resolved arguments.
Sourcepub fn args(&self) -> &ActionArgs
pub fn args(&self) -> &ActionArgs
Returns resolved invocation arguments.
Sourcepub fn source(&self) -> InvocationSource
pub fn source(&self) -> InvocationSource
Returns the surface that requested this invocation.
Trait Implementations§
Source§impl Clone for ActionInvocation
impl Clone for ActionInvocation
Source§fn clone(&self) -> ActionInvocation
fn clone(&self) -> ActionInvocation
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ActionInvocation
impl Debug for ActionInvocation
impl Eq for ActionInvocation
Source§impl PartialEq for ActionInvocation
impl PartialEq for ActionInvocation
Source§fn eq(&self, other: &ActionInvocation) -> bool
fn eq(&self, other: &ActionInvocation) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for ActionInvocation
Auto Trait Implementations§
impl Freeze for ActionInvocation
impl RefUnwindSafe for ActionInvocation
impl Send for ActionInvocation
impl Sync for ActionInvocation
impl Unpin for ActionInvocation
impl UnsafeUnpin for ActionInvocation
impl UnwindSafe for ActionInvocation
Blanket Implementations§
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
Mutably borrows from an owned value. Read more