pub trait HasBounds<T: 'static>: Bounds {
// Required methods
fn cast_box(this: Box<T>) -> Box<Self::Container>;
fn as_ref(this: &T) -> &Self::Container;
fn as_mut(this: &mut T) -> &mut Self::Container;
fn cast_key_box(this: Box<T>) -> Box<Self::KeyContainer>
where T: 'static + Sized + Hash + Eq;
// Provided methods
fn box_key(this: T) -> Box<Self::KeyContainer>
where T: 'static + Sized + Hash + Eq { ... }
fn box_value(this: T) -> Box<Self::Container>
where Self: Sized { ... }
fn downcast_ref(this: &Self::Container) -> Option<&T>
where Self: 'static + Sized { ... }
fn downcast_mut(this: &mut Self::Container) -> Option<&mut T>
where Self: 'static + Sized { ... }
fn downcast_box(
this: Box<Self::Container>
) -> Result<Box<T>, Box<Self::Container>>
where Self: 'static + Sized { ... }
}
Expand description
Trait that marks that specific type fulfill specified bounds.
For example HasBounds<CloneBounds>
is implemented for all types that are implement Clone & Any.
Required Methods§
sourcefn cast_key_box(this: Box<T>) -> Box<Self::KeyContainer>
fn cast_key_box(this: Box<T>) -> Box<Self::KeyContainer>
Converts from Box<T>
to Box<KeyContainer>
Provided Methods§
sourcefn box_key(this: T) -> Box<Self::KeyContainer>
fn box_key(this: T) -> Box<Self::KeyContainer>
Boxes key of type T
as Box<KeyContainer>
sourcefn box_value(this: T) -> Box<Self::Container>where
Self: Sized,
fn box_value(this: T) -> Box<Self::Container>where
Self: Sized,
Boxes value of type T
as Box<Container>
sourcefn downcast_ref(this: &Self::Container) -> Option<&T>where
Self: 'static + Sized,
fn downcast_ref(this: &Self::Container) -> Option<&T>where
Self: 'static + Sized,
Attempts to downcast &Container
to &T
Object Safety§
This trait is not object safe.