pub trait Context:
Sync
+ Send
+ AnySync {
// Required method
fn term(&self) -> Arc<Terminal> ⓘ;
}Expand description
Shared execution context passed to command handlers, providing access to the underlying terminal and allowing downcasting to a concrete type.
Required Methods§
Implementations§
Source§impl dyn Context
impl dyn Context
pub fn is<_T>(&self) -> bool
pub fn downcast_ref<_T>(&self) -> Result<&_T, TypeMismatch>
pub fn downcast_mut<_T>(&mut self) -> Result<&mut _T, TypeMismatch>
pub fn downcast<_T>( self: Box<Self>, ) -> Result<Box<_T>, DowncastError<Box<Self>>>
pub fn downcast_rc<_T>( self: Rc<Self>, ) -> Result<Rc<_T>, DowncastError<Rc<Self>>>
pub fn downcast_arc<_T>(
self: Arc<Self>,
) -> Result<Arc<_T>, DowncastError<Arc<Self>>>where
_T: AnySync,
Self: DowncastSync<_T>,
Source§impl dyn Context + Sync + Send
impl dyn Context + Sync + Send
pub fn is<_T>(&self) -> bool
pub fn downcast_ref<_T>(&self) -> Result<&_T, TypeMismatch>
pub fn downcast_mut<_T>(&mut self) -> Result<&mut _T, TypeMismatch>
pub fn downcast<_T>( self: Box<Self>, ) -> Result<Box<_T>, DowncastError<Box<Self>>>
pub fn downcast_rc<_T>( self: Rc<Self>, ) -> Result<Rc<_T>, DowncastError<Rc<Self>>>
pub fn downcast_arc<_T>(
self: Arc<Self>,
) -> Result<Arc<_T>, DowncastError<Arc<Self>>>where
_T: AnySync,
Self: DowncastSync<_T>,
Trait Implementations§
Source§impl<_T> Downcast<_T> for dyn Contextwhere
_T: Any,
impl<_T> Downcast<_T> for dyn Contextwhere
_T: Any,
fn is_type(&self) -> bool
fn downcast_ref(&self) -> Result<&T, TypeMismatch>
fn downcast_mut(&mut self) -> Result<&mut T, TypeMismatch>
fn downcast(self: Box<Self>) -> Result<Box<T>, DowncastError<Box<Self>>>
fn downcast_rc(self: Rc<Self>) -> Result<Rc<T>, DowncastError<Rc<Self>>>
Source§impl<_T> Downcast<_T> for dyn Context + Sync + Sendwhere
_T: Any,
impl<_T> Downcast<_T> for dyn Context + Sync + Sendwhere
_T: Any,
fn is_type(&self) -> bool
fn downcast_ref(&self) -> Result<&T, TypeMismatch>
fn downcast_mut(&mut self) -> Result<&mut T, TypeMismatch>
fn downcast(self: Box<Self>) -> Result<Box<T>, DowncastError<Box<Self>>>
fn downcast_rc(self: Rc<Self>) -> Result<Rc<T>, DowncastError<Rc<Self>>>
Source§impl<_T> DowncastSync<_T> for dyn Contextwhere
_T: AnySync,
impl<_T> DowncastSync<_T> for dyn Contextwhere
_T: AnySync,
fn downcast_arc(self: Arc<Self>) -> Result<Arc<T>, DowncastError<Arc<Self>>>
Source§impl<_T> DowncastSync<_T> for dyn Context + Sync + Sendwhere
_T: AnySync,
impl<_T> DowncastSync<_T> for dyn Context + Sync + Sendwhere
_T: AnySync,
fn downcast_arc(self: Arc<Self>) -> Result<Arc<T>, DowncastError<Arc<Self>>>
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".