Skip to main content

Value

Trait Value 

Source
pub trait Value:
    Any
    + Send
    + Sync
    + 'static {
    // Required methods
    fn as_any(&self) -> &(dyn Any + 'static);
    fn as_any_mut(&mut self) -> &mut (dyn Any + 'static);
    fn into_any(self: Box<Self>) -> Box<dyn Any>;
}
Expand description

Type-erased value passed between pipeline tasks.

Automatically implemented for every T: Any + Send + Sync + 'static. Use value.as_any().downcast_ref::<T>() for a borrowed &T, or downcast_value to recover an owned Box<T>.

Both Send and Sync are required because the executor shares values via Arc<dyn Value> across retry attempts and fan-out.

Required Methods§

Source

fn as_any(&self) -> &(dyn Any + 'static)

Source

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Source

fn into_any(self: Box<Self>) -> Box<dyn Any>

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<T> Value for T
where T: Any + Send + Sync + 'static,