Skip to main content

AsAny

Trait AsAny 

Source
pub trait AsAny {
    // Required method
    fn as_any(&self) -> &dyn Any;
}
Expand description

Erase to dyn Any, so a dyn Filter or dyn Step can be downcast to the concrete type behind it.

A supertrait with a blanket impl rather than a required method. Filter and Step both demanded fn as_any(&self) -> &dyn Any { self } from every implementor — sixty-odd identical bodies across the workspace, and one more required of anyone writing a filter of their own — to serve two downcasts in the whole codebase.

Required Methods§

Source

fn as_any(&self) -> &dyn Any

The receiver as &dyn Any, ready for downcast_ref.

Implementors§

Source§

impl<T: Any> AsAny for T