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§
impl<T: ?Sized> Container<T> for Box<T>
Available on crate features
alloc only.impl<T: ?Sized> Container<T> for Rc<T>
Available on crate features
alloc only.impl<T: ?Sized> Container<T> for Arc<T>
Available on crate features
alloc only.