Trait Container

Source
pub trait Container<T: ?Sized>: FragileContainer<T> + TryContainer<T> { }
Expand description

An abstraction over some container which owns a T and can infallibly provide immutable references to it, or attempt to be consumed to return the inner T (if T is Sized).

§None values

Note that into_inner is still permitted to return None, even though get_ref does not fail, and most implementors should make try_get_ref infallible as well. A container should clearly document when into_inner returns None.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<T: ?Sized> Container<T> for Box<T>

Source§

impl<T: ?Sized> Container<T> for Rc<T>

Source§

impl<T: ?Sized> Container<T> for Arc<T>

Implementors§

Source§

impl<T: ?Sized> Container<T> for T