[][src]Trait core_extensions::collection_traits::Cloned

pub trait Cloned {
    type Cloned;
    fn cloned_(&self) -> Self::Cloned;

Clones a fixed-sized collection of references into a collection of values.


This trait is only implemented for built-in/core types
if the "colltraits" cargo feature is enabled.

Enabling the "alloc" or "std" features changes the impl from this crate from using Clone bounds to using ToOwned (ToOwned is declared in the alloc crate).

ToOwned is implemented for all types that implement Clone, and is not declared in core, which means that you can't call cloned_ on (&str,) or (&[T],) without enabling either the "alloc" or "std" features.

Tuple Example

This example is not tested
use core_extensions::collection_traits::Cloned;

assert_eq!( (&2,).cloned_(), (2,) );
assert_eq!( (&2,&3).cloned_(), (2,3) );
assert_eq!( (&2,&3,&5).cloned_(), (2,3,5) );
assert_eq!( (&2,&3,&5,&8).cloned_(), (2,3,5,8) );

Associated Types

type Cloned

The type of this tuple with owned values instead of references to them.

Loading content...

Required methods

fn cloned_(&self) -> Self::Cloned

Clones a tuple of references into a tuple of values.

Loading content...


Loading content...