pub struct CommandContext {
pub context: EditContext,
/* private fields */
}
Expand description
Context object passed to each CommandFunc.
Fields§
§context: EditContext
Contextual information from user input.
Implementations§
source§impl CommandContext
impl CommandContext
sourcepub fn default_axis(&mut self, axis: Axis) -> &mut Self
pub fn default_axis(&mut self, axis: Axis) -> &mut Self
Indicate a default Axis to use when one hasn’t been specified via a prefix command (e.g.
:vertical
).
sourcepub fn default_relation(&mut self, relation: MoveDir1D) -> &mut Self
pub fn default_relation(&mut self, relation: MoveDir1D) -> &mut Self
Indicate a default MoveDir1D value to use when one hasn’t been specified via a prefix command (e.g.
:aboveleft
).
sourcepub fn relation(&self) -> MoveDir1D
pub fn relation(&self) -> MoveDir1D
Get the contextual MoveDir1D relation for newly opened windows.
sourcepub fn open<I>(
&self,
target: OpenTarget<I::WindowId>,
count: Count
) -> Action<I>where
I: ApplicationInfo,
pub fn open<I>(
&self,
target: OpenTarget<I::WindowId>,
count: Count
) -> Action<I>where
I: ApplicationInfo,
Use the contextual information to create a new WindowAction::Open for the given target and size.
sourcepub fn split<I>(
&self,
target: OpenTarget<I::WindowId>,
count: Count
) -> Action<I>where
I: ApplicationInfo,
pub fn split<I>(
&self,
target: OpenTarget<I::WindowId>,
count: Count
) -> Action<I>where
I: ApplicationInfo,
Use the contextual information to create a new WindowAction::Split for the given target and number of splits.
sourcepub fn switch<I>(&self, target: OpenTarget<I::WindowId>) -> Action<I>where
I: ApplicationInfo,
pub fn switch<I>(&self, target: OpenTarget<I::WindowId>) -> Action<I>where
I: ApplicationInfo,
If no contextual information has been provided, create a new WindowAction::Switch for the
given target. If contextual information has been provided via commands like :tab
,
:vertical
, or :aboveleft
, then open the target in a new window instead.
This is meant to be a more user-friendly way to handle commands that switch to a new window by doing what the user like wanted when they used a prefix command.
sourcepub fn window<I>(
&self,
target: OpenTarget<I::WindowId>,
size: Option<Count>
) -> Action<I>where
I: ApplicationInfo,
pub fn window<I>(
&self,
target: OpenTarget<I::WindowId>,
size: Option<Count>
) -> Action<I>where
I: ApplicationInfo,
Open a new window for the given target.
If size
is specified, the window will be opened with that width or height.
Trait Implementations§
source§impl Clone for CommandContext
impl Clone for CommandContext
source§fn clone(&self) -> CommandContext
fn clone(&self) -> CommandContext
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for CommandContext
impl Debug for CommandContext
source§impl Default for CommandContext
impl Default for CommandContext
source§impl From<EditContext> for CommandContext
impl From<EditContext> for CommandContext
source§fn from(context: EditContext) -> Self
fn from(context: EditContext) -> Self
source§impl PartialEq for CommandContext
impl PartialEq for CommandContext
source§fn eq(&self, other: &CommandContext) -> bool
fn eq(&self, other: &CommandContext) -> bool
self
and other
values to be equal, and is used
by ==
.impl Eq for CommandContext
impl StructuralPartialEq for CommandContext
Auto Trait Implementations§
impl Freeze for CommandContext
impl RefUnwindSafe for CommandContext
impl Send for CommandContext
impl Sync for CommandContext
impl Unpin for CommandContext
impl UnwindSafe for CommandContext
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
source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
source§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
.source§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
.source§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.source§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.source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.