Skip to main content

SimpleCollectionRef

Trait SimpleCollectionRef 

Source
pub trait SimpleCollectionRef: CollectionRef {
    // Required method
    fn into_ref<'r>(r: Self::ItemRef<'r>) -> &'r Self::Item
       where Self: 'r;
}
Expand description

Collection where each item reference can be converted into a standard “simple” rust reference.

This trait is particularly useful to avoid having to include where bounds of the form for<'r> T::ItemRef<'r>: Into<&'r T::Item>, which can currently lead the compiler to try to prove T: 'static (see https://github.com/rust-lang/rust/pull/96709#issuecomment-1182403490) for more details.

Required Methods§

Source

fn into_ref<'r>(r: Self::ItemRef<'r>) -> &'r Self::Item
where Self: 'r,

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementations on Foreign Types§

Source§

impl<K, V> SimpleCollectionRef for BTreeMap<K, V>

Source§

fn into_ref<'r>(r: Self::ItemRef<'r>) -> &'r Self::Item
where Self: 'r,

Source§

impl<K, V> SimpleCollectionRef for HashMap<K, V>

Source§

fn into_ref<'r>(r: Self::ItemRef<'r>) -> &'r Self::Item
where Self: 'r,

Source§

impl<T> SimpleCollectionRef for BTreeSet<T>

Source§

fn into_ref<'r>(r: Self::ItemRef<'r>) -> &'r Self::Item
where Self: 'r,

Source§

impl<T> SimpleCollectionRef for HashSet<T>

Source§

fn into_ref<'r>(r: Self::ItemRef<'r>) -> &'r Self::Item
where Self: 'r,

Source§

impl<T> SimpleCollectionRef for Vec<T>

Source§

fn into_ref<'r>(r: Self::ItemRef<'r>) -> &'r Self::Item
where Self: 'r,

Source§

impl<T> SimpleCollectionRef for VecDeque<T>

Source§

fn into_ref<'r>(r: Self::ItemRef<'r>) -> &'r Self::Item
where Self: 'r,

Implementors§