pub trait Clone: Sized {
// Required method
fn clone(&self) -> Self;
// Provided method
fn clone_from(&mut self, source: &Self) { ... }
}Expand description
A common trait that allows explicit creation of a duplicate value.
Calling clone always produces a new value.
However, for types that are references to other data (such as smart pointers or references),
the new value may still point to the same underlying data, rather than duplicating it.
See Clone::clone for more details.
This distinction is especially important when using #[derive(Clone)] on structs containing
smart pointers like Arc<Mutex<T>> - the cloned struct will share mutable state with the
original.
Differs from Copy in that Copy is implicit and an inexpensive bit-wise copy, while
Clone is always explicit and may or may not be expensive. In order to enforce
these characteristics, Rust does not allow you to reimplement Copy, but you
may reimplement Clone and run arbitrary code.
Since Clone is more general than Copy, you can automatically make anything
Copy be Clone as well.
§Derivable
This trait can be used with #[derive] if all fields are Clone. The derived
implementation of Clone calls clone on each field.
For a generic struct, #[derive] implements Clone conditionally by adding bound Clone on
generic parameters.
// `derive` implements Clone for Reading<T> when T is Clone.
#[derive(Clone)]
struct Reading<T> {
frequency: T,
}§How can I implement Clone?
Types that are Copy should have a trivial implementation of Clone. More formally:
if T: Copy, x: T, and y: &T, then let x = y.clone(); is equivalent to let x = *y;.
Manual implementations should be careful to uphold this invariant; however, unsafe code
must not rely on it to ensure memory safety.
An example is a generic struct holding a function pointer. In this case, the
implementation of Clone cannot be derived, but can be implemented as:
struct Generate<T>(fn() -> T);
impl<T> Copy for Generate<T> {}
impl<T> Clone for Generate<T> {
fn clone(&self) -> Self {
*self
}
}If we derive:
#[derive(Copy, Clone)]
struct Generate<T>(fn() -> T);the auto-derived implementations will have unnecessary T: Copy and T: Clone bounds:
// Automatically derived
impl<T: Copy> Copy for Generate<T> { }
// Automatically derived
impl<T: Clone> Clone for Generate<T> {
fn clone(&self) -> Generate<T> {
Generate(Clone::clone(&self.0))
}
}The bounds are unnecessary because clearly the function itself should be copy- and cloneable even if its return type is not:
#[derive(Copy, Clone)]
struct Generate<T>(fn() -> T);
struct NotCloneable;
fn generate_not_cloneable() -> NotCloneable {
NotCloneable
}
Generate(generate_not_cloneable).clone(); // error: trait bounds were not satisfied
// Note: With the manual implementations the above line will compile.§Clone and PartialEq/Eq
Clone is intended for the duplication of objects. Consequently, when implementing
both Clone and PartialEq, the following property is expected to hold:
x == x -> x.clone() == xIn other words, if an object compares equal to itself, its clone must also compare equal to the original.
For types that also implement Eq – for which x == x always holds –
this implies that x.clone() == x must always be true.
Standard library collections such as
HashMap, HashSet, BTreeMap, BTreeSet and BinaryHeap
rely on their keys respecting this property for correct behavior.
Furthermore, these collections require that cloning a key preserves the outcome of the
Hash and Ord methods. Thankfully, this follows automatically from x.clone() == x
if Hash and Ord are correctly implemented according to their own requirements.
When deriving both Clone and PartialEq using #[derive(Clone, PartialEq)]
or when additionally deriving Eq using #[derive(Clone, PartialEq, Eq)],
then this property is automatically upheld – provided that it is satisfied by
the underlying types.
Violating this property is a logic error. The behavior resulting from a logic error is not
specified, but users of the trait must ensure that such logic errors do not result in
undefined behavior. This means that unsafe code must not rely on this property
being satisfied.
§Additional implementors
In addition to the implementors listed below,
the following types also implement Clone:
- Function item types (i.e., the distinct types defined for each function)
- Function pointer types (e.g.,
fn() -> i32) - Closure types, if they capture no value from the environment
or if all such captured values implement
Clonethemselves. Note that variables captured by shared reference always implementClone(even if the referent doesn’t), while variables captured by mutable reference never implementClone.
Required Methods§
1.0.0 · Sourcefn clone(&self) -> Self
fn clone(&self) -> Self
Returns a duplicate of the value.
Note that what “duplicate” means varies by type:
- For most types, this creates a deep, independent copy
- For reference types like
&T, this creates another reference to the same value - For smart pointers like
ArcorRc, this increments the reference count but still points to the same underlying data
§Examples
let hello = "Hello"; // &str implements Clone
assert_eq!("Hello", hello.clone());Example with a reference-counted type:
use std::sync::{Arc, Mutex};
let data = Arc::new(Mutex::new(vec![1, 2, 3]));
let data_clone = data.clone(); // Creates another Arc pointing to the same Mutex
{
let mut lock = data.lock().unwrap();
lock.push(4);
}
// Changes are visible through the clone because they share the same underlying data
assert_eq!(*data_clone.lock().unwrap(), vec![1, 2, 3, 4]);Provided Methods§
1.0.0 · Sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source.
a.clone_from(&b) is equivalent to a = b.clone() in functionality,
but can be overridden to reuse the resources of a to avoid unnecessary
allocations.
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.
Implementors§
impl Clone for browser_window::browser::Source
impl Clone for JsValue
impl Clone for TryReserveErrorKind
impl Clone for AsciiChar
impl Clone for core::cmp::Ordering
impl Clone for Infallible
impl Clone for FromBytesWithNulError
impl Clone for core::fmt::Alignment
impl Clone for DebugAsHex
impl Clone for Sign
impl Clone for IpAddr
impl Clone for Ipv6MulticastScope
impl Clone for core::net::socket_addr::SocketAddr
impl Clone for FpCategory
impl Clone for IntErrorKind
impl Clone for GetDisjointMutError
impl Clone for SearchStep
impl Clone for core::sync::atomic::Ordering
impl Clone for VarError
impl Clone for SeekFrom
impl Clone for ErrorKind
impl Clone for Shutdown
impl Clone for BacktraceStyle
impl Clone for RecvTimeoutError
impl Clone for TryRecvError
impl Clone for JsonValue
impl Clone for qos_class_t
impl Clone for sysdir_search_path_directory_t
impl Clone for sysdir_search_path_domain_mask_t
impl Clone for timezone
impl Clone for num_bigfloat::defs::Error
impl Clone for RoundingMode
impl Clone for BernoulliError
impl Clone for WeightedError
impl Clone for IndexVec
impl Clone for IndexVecIntoIter
impl Clone for BigEndian
impl Clone for LittleEndian
impl Clone for bool
impl Clone for char
impl Clone for f16
impl Clone for f32
impl Clone for f64
impl Clone for f128
impl Clone for i8
impl Clone for i16
impl Clone for i32
impl Clone for i64
impl Clone for i128
impl Clone for isize
impl Clone for !
impl Clone for u8
impl Clone for u16
impl Clone for u32
impl Clone for u64
impl Clone for u128
impl Clone for usize
impl Clone for ApplicationHandle
impl Clone for ApplicationHandleThreaded
impl Clone for BrowserWindow
impl Clone for BrowserWindowThreaded
impl Clone for BigFloat
impl Clone for ApplicationImpl
impl Clone for BrowserWindowImpl
impl Clone for WindowImpl
impl Clone for Global
impl Clone for Box<str>
impl Clone for Box<ByteStr>
impl Clone for Box<CStr>
impl Clone for Box<OsStr>
impl Clone for Box<Path>
impl Clone for ByteString
impl Clone for UnorderedKeyError
impl Clone for TryReserveError
impl Clone for CString
impl Clone for FromVecWithNulError
impl Clone for IntoStringError
impl Clone for NulError
impl Clone for FromUtf8Error
impl Clone for IntoChars
impl Clone for String
impl Clone for Layout
impl Clone for LayoutError
impl Clone for core::alloc::AllocError
impl Clone for TypeId
impl Clone for TryFromSliceError
impl Clone for core::ascii::EscapeDefault
impl Clone for CharTryFromError
impl Clone for ParseCharError
impl Clone for DecodeUtf16Error
impl Clone for core::char::EscapeDebug
impl Clone for core::char::EscapeDefault
impl Clone for core::char::EscapeUnicode
impl Clone for ToLowercase
impl Clone for ToUppercase
impl Clone for TryFromCharError
impl Clone for float64x1_t
impl Clone for float64x1x2_t
impl Clone for float64x1x3_t
impl Clone for float64x1x4_t
impl Clone for float64x2_t
impl Clone for float64x2x2_t
impl Clone for float64x2x3_t
impl Clone for float64x2x4_t
impl Clone for float16x4_t
impl Clone for float16x4x2_t
impl Clone for float16x4x3_t
impl Clone for float16x4x4_t
impl Clone for float16x8_t
impl Clone for float16x8x2_t
impl Clone for float16x8x3_t
impl Clone for float16x8x4_t
impl Clone for float32x2_t
impl Clone for float32x2x2_t
impl Clone for float32x2x3_t
impl Clone for float32x2x4_t
impl Clone for float32x4_t
impl Clone for float32x4x2_t
impl Clone for float32x4x3_t
impl Clone for float32x4x4_t
impl Clone for int8x8_t
impl Clone for int8x8x2_t
impl Clone for int8x8x3_t
impl Clone for int8x8x4_t
impl Clone for int8x16_t
impl Clone for int8x16x2_t
impl Clone for int8x16x3_t
impl Clone for int8x16x4_t
impl Clone for int16x4_t
impl Clone for int16x4x2_t
impl Clone for int16x4x3_t
impl Clone for int16x4x4_t
impl Clone for int16x8_t
impl Clone for int16x8x2_t
impl Clone for int16x8x3_t
impl Clone for int16x8x4_t
impl Clone for int32x2_t
impl Clone for int32x2x2_t
impl Clone for int32x2x3_t
impl Clone for int32x2x4_t
impl Clone for int32x4_t
impl Clone for int32x4x2_t
impl Clone for int32x4x3_t
impl Clone for int32x4x4_t
impl Clone for int64x1_t
impl Clone for int64x1x2_t
impl Clone for int64x1x3_t
impl Clone for int64x1x4_t
impl Clone for int64x2_t
impl Clone for int64x2x2_t
impl Clone for int64x2x3_t
impl Clone for int64x2x4_t
impl Clone for poly8x8_t
impl Clone for poly8x8x2_t
impl Clone for poly8x8x3_t
impl Clone for poly8x8x4_t
impl Clone for poly8x16_t
impl Clone for poly8x16x2_t
impl Clone for poly8x16x3_t
impl Clone for poly8x16x4_t
impl Clone for poly16x4_t
impl Clone for poly16x4x2_t
impl Clone for poly16x4x3_t
impl Clone for poly16x4x4_t
impl Clone for poly16x8_t
impl Clone for poly16x8x2_t
impl Clone for poly16x8x3_t
impl Clone for poly16x8x4_t
impl Clone for poly64x1_t
impl Clone for poly64x1x2_t
impl Clone for poly64x1x3_t
impl Clone for poly64x1x4_t
impl Clone for poly64x2_t
impl Clone for poly64x2x2_t
impl Clone for poly64x2x3_t
impl Clone for poly64x2x4_t
impl Clone for uint8x8_t
impl Clone for uint8x8x2_t
impl Clone for uint8x8x3_t
impl Clone for uint8x8x4_t
impl Clone for uint8x16_t
impl Clone for uint8x16x2_t
impl Clone for uint8x16x3_t
impl Clone for uint8x16x4_t
impl Clone for uint16x4_t
impl Clone for uint16x4x2_t
impl Clone for uint16x4x3_t
impl Clone for uint16x4x4_t
impl Clone for uint16x8_t
impl Clone for uint16x8x2_t
impl Clone for uint16x8x3_t
impl Clone for uint16x8x4_t
impl Clone for uint32x2_t
impl Clone for uint32x2x2_t
impl Clone for uint32x2x3_t
impl Clone for uint32x2x4_t
impl Clone for uint32x4_t
impl Clone for uint32x4x2_t
impl Clone for uint32x4x3_t
impl Clone for uint32x4x4_t
impl Clone for uint64x1_t
impl Clone for uint64x1x2_t
impl Clone for uint64x1x3_t
impl Clone for uint64x1x4_t
impl Clone for uint64x2_t
impl Clone for uint64x2x2_t
impl Clone for uint64x2x3_t
impl Clone for uint64x2x4_t
impl Clone for FromBytesUntilNulError
impl Clone for core::fmt::Error
impl Clone for FormattingOptions
impl Clone for SipHasher
impl Clone for PhantomPinned
impl Clone for Assume
impl Clone for Ipv4Addr
impl Clone for Ipv6Addr
impl Clone for AddrParseError
impl Clone for SocketAddrV4
impl Clone for SocketAddrV6
impl Clone for ParseFloatError
impl Clone for ParseIntError
impl Clone for TryFromIntError
impl Clone for RangeFull
impl Clone for core::ptr::alignment::Alignment
impl Clone for ParseBoolError
impl Clone for Utf8Error
impl Clone for LocalWaker
impl Clone for RawWakerVTable
impl Clone for Waker
impl Clone for Duration
impl Clone for TryFromFloatSecsError
impl Clone for System
impl Clone for OsString
impl Clone for FileTimes
impl Clone for FileType
impl Clone for Metadata
impl Clone for OpenOptions
impl Clone for Permissions
impl Clone for DefaultHasher
impl Clone for RandomState
impl Clone for std::io::util::Empty
impl Clone for Sink
impl Clone for std::os::darwin::raw::stat
impl Clone for std::os::unix::net::addr::SocketAddr
impl Clone for UCred
impl Clone for PathBuf
impl Clone for StripPrefixError
impl Clone for ExitCode
impl Clone for ExitStatus
impl Clone for ExitStatusError
impl Clone for Output
impl Clone for DefaultRandomSource
impl Clone for RecvError
impl Clone for WaitTimeoutResult
impl Clone for AccessError
impl Clone for Thread
impl Clone for ThreadId
impl Clone for Instant
impl Clone for SystemTime
impl Clone for SystemTimeError
impl Clone for c_G_fpos64_t
impl Clone for c_G_fpos_t
impl Clone for c_IO_FILE
impl Clone for c_IO_codecvt
impl Clone for c_IO_marker
impl Clone for c_IO_wide_data
impl Clone for c__atomic_wide_counter__bindgen_ty_1
impl Clone for c__fsid_t
impl Clone for c__locale_data
impl Clone for c__locale_struct
impl Clone for c__mbstate_t
impl Clone for c__once_flag
impl Clone for c__pthread_cond_s
impl Clone for c__pthread_internal_list
impl Clone for c__pthread_internal_slist
impl Clone for c__pthread_mutex_s
impl Clone for c__pthread_rwlock_arch_t
impl Clone for c__sigset_t
impl Clone for c__va_list_tag
impl Clone for cbw_Application
impl Clone for cbw_ApplicationDispatchData
impl Clone for cbw_ApplicationEngineData
impl Clone for cbw_ApplicationEngineImpl
impl Clone for cbw_ApplicationImpl
impl Clone for cbw_ApplicationSettings
impl Clone for cbw_BrowserWindow
impl Clone for cbw_BrowserWindowEvents
impl Clone for cbw_BrowserWindowImpl
impl Clone for cbw_BrowserWindowMessageArgs
impl Clone for cbw_BrowserWindowOptions
impl Clone for cbw_BrowserWindowSource
impl Clone for cbw_CStrSlice
impl Clone for cbw_Cookie
impl Clone for cbw_CookieImpl
impl Clone for cbw_CookieIterator
impl Clone for cbw_CookieIteratorImpl
impl Clone for cbw_CookieJar
impl Clone for cbw_CookieJarImpl
impl Clone for cbw_Dims2D
impl Clone for cbw_Err
impl Clone for cbw_Event
impl Clone for cbw_Pos2D
impl Clone for cbw_StrSlice
impl Clone for cbw_Window
impl Clone for cbw_WindowDispatchData
impl Clone for cbw_WindowImpl
impl Clone for cbw_WindowOptions
impl Clone for cdiv_t
impl Clone for cdrand48_data
impl Clone for cfd_set
impl Clone for cldiv_t
impl Clone for clldiv_t
impl Clone for cmax_align_t
impl Clone for crandom_data
impl Clone for ctimespec
impl Clone for ctimeval
impl Clone for futures_channel::mpsc::SendError
impl Clone for Canceled
impl Clone for getrandom::error::Error
impl Clone for Number
impl Clone for NumberOutOfScope
impl Clone for Object
impl Clone for Short
impl Clone for __darwin_arm_exception_state64
impl Clone for __darwin_arm_neon_state64
impl Clone for __darwin_arm_thread_state64
impl Clone for __darwin_mcontext64
impl Clone for malloc_zone_t
impl Clone for max_align_t
impl Clone for ucontext_t
impl Clone for bpf_hdr
impl Clone for if_data
impl Clone for pthread_attr_t
impl Clone for pthread_once_t
impl Clone for timeval32
impl Clone for Dl_info
impl Clone for addrinfo
impl Clone for aiocb
impl Clone for arphdr
impl Clone for attribute_set_t
impl Clone for attrlist
impl Clone for attrreference_t
impl Clone for ctl_info
impl Clone for dirent
impl Clone for dqblk
impl Clone for flock
impl Clone for fpunchhole_t
impl Clone for fspecread_t
impl Clone for fstore_t
impl Clone for ftrimactivefile_t
impl Clone for glob_t
impl Clone for host_cpu_load_info
impl Clone for icmp6_ifstat
impl Clone for if_data64
impl Clone for if_msghdr2
impl Clone for if_msghdr
impl Clone for ifa_msghdr
impl Clone for ifconf
impl Clone for ifdevmtu
impl Clone for ifkpi
impl Clone for ifma_msghdr2
impl Clone for ifma_msghdr
impl Clone for ifmibdata
impl Clone for ifreq
impl Clone for ifs_iso_8802_3
impl Clone for image_offset
impl Clone for in6_addrlifetime
impl Clone for in6_ifreq
impl Clone for in6_ifstat
impl Clone for in6_pktinfo
impl Clone for in_addr
impl Clone for in_pktinfo
impl Clone for ip_mreq
impl Clone for ip_mreq_source
impl Clone for ip_mreqn
impl Clone for ipc_perm
impl Clone for kevent64_s
impl Clone for kevent
impl Clone for lconv
impl Clone for load_command
impl Clone for log2phys
impl Clone for mach_header
impl Clone for mach_header_64
impl Clone for mach_task_basic_info
impl Clone for mach_timebase_info
impl Clone for malloc_statistics_t
impl Clone for mstats
impl Clone for ntptimeval
impl Clone for os_unfair_lock_s
impl Clone for proc_bsdinfo
impl Clone for proc_fdinfo
impl Clone for proc_taskallinfo
impl Clone for proc_taskinfo
impl Clone for proc_threadinfo
impl Clone for proc_vnodepathinfo
impl Clone for processor_basic_info
impl Clone for processor_cpu_load_info
impl Clone for processor_set_basic_info
impl Clone for processor_set_load_info
impl Clone for pthread_cond_t
impl Clone for pthread_condattr_t
impl Clone for pthread_mutex_t
impl Clone for pthread_mutexattr_t
impl Clone for pthread_rwlock_t
impl Clone for pthread_rwlockattr_t
impl Clone for radvisory
impl Clone for rt_metrics
impl Clone for rt_msghdr2
impl Clone for rt_msghdr
impl Clone for rusage_info_v0
impl Clone for rusage_info_v1
impl Clone for rusage_info_v2
impl Clone for rusage_info_v3
impl Clone for rusage_info_v4
impl Clone for sa_endpoints_t
impl Clone for sched_param
impl Clone for segment_command
impl Clone for segment_command_64
impl Clone for sembuf
impl Clone for semid_ds
impl Clone for sf_hdtr
impl Clone for shmid_ds
impl Clone for sigaction
impl Clone for sigevent
impl Clone for siginfo_t
impl Clone for sockaddr_ctl
impl Clone for sockaddr_dl
impl Clone for sockaddr_in
impl Clone for sockaddr_inarp
impl Clone for sockaddr_ndrv
impl Clone for sockaddr_storage
impl Clone for sockaddr_vm
impl Clone for stack_t
impl Clone for libc::unix::bsd::apple::stat
impl Clone for statfs
impl Clone for statvfs
impl Clone for task_thread_times_info
impl Clone for tcp_connection_info
impl Clone for termios
impl Clone for thread_affinity_policy
impl Clone for thread_background_policy
impl Clone for thread_basic_info
impl Clone for thread_extended_info
impl Clone for thread_extended_policy
impl Clone for thread_identifier_info
impl Clone for thread_latency_qos_policy
impl Clone for thread_precedence_policy
impl Clone for thread_standard_policy
impl Clone for thread_throughput_qos_policy
impl Clone for thread_time_constraint_policy
impl Clone for time_value_t
impl Clone for timex
impl Clone for utmpx
impl Clone for vinfo_stat
impl Clone for vm_range_t
impl Clone for vm_statistics64
impl Clone for vm_statistics
impl Clone for vnode_info
impl Clone for vnode_info_path
impl Clone for vol_attributes_attr_t
impl Clone for vol_capabilities_attr_t
impl Clone for xsw_usage
impl Clone for xucred
impl Clone for cmsghdr
impl Clone for fd_set
impl Clone for fsid_t
impl Clone for if_nameindex
impl Clone for ifaddrs
impl Clone for msghdr
impl Clone for option
impl Clone for passwd
impl Clone for regex_t
impl Clone for regmatch_t
impl Clone for sockaddr
impl Clone for sockaddr_in6
impl Clone for sockaddr_un
impl Clone for tm
impl Clone for utsname
impl Clone for group
impl Clone for hostent
impl Clone for in6_addr
impl Clone for iovec
impl Clone for ipv6_mreq
impl Clone for itimerval
impl Clone for linger
impl Clone for pollfd
impl Clone for protoent
impl Clone for rlimit
impl Clone for rusage
impl Clone for servent
impl Clone for sigval
impl Clone for timespec
impl Clone for timeval
impl Clone for tms
impl Clone for utimbuf
impl Clone for winsize
impl Clone for G0
impl Clone for G1
impl Clone for GenericMachine
impl Clone for u32x4_generic
impl Clone for u64x2_generic
impl Clone for u128x1_generic
impl Clone for vec256_storage
impl Clone for vec512_storage
impl Clone for Bernoulli
impl Clone for Open01
impl Clone for OpenClosed01
impl Clone for Alphanumeric
impl Clone for Standard
impl Clone for UniformChar
impl Clone for UniformDuration
impl Clone for StepRng
impl Clone for StdRng
impl Clone for ThreadRng
impl Clone for ChaCha8Core
impl Clone for ChaCha8Rng
impl Clone for ChaCha12Core
impl Clone for ChaCha12Rng
impl Clone for ChaCha20Core
impl Clone for ChaCha20Rng
impl Clone for OsRng
impl Clone for IgnoredAny
impl Clone for serde_core::de::value::Error
impl Clone for zerocopy::error::AllocError
impl Clone for c__atomic_wide_counter
impl Clone for c__mbstate_t__bindgen_ty_1
impl Clone for cpthread_attr_t
impl Clone for cpthread_barrier_t
impl Clone for cpthread_barrierattr_t
impl Clone for cpthread_cond_t
impl Clone for cpthread_condattr_t
impl Clone for cpthread_mutex_t
impl Clone for cpthread_mutexattr_t
impl Clone for cpthread_rwlock_t
impl Clone for cpthread_rwlockattr_t
impl Clone for __c_anonymous_ifc_ifcu
impl Clone for __c_anonymous_ifk_data
impl Clone for __c_anonymous_ifr_ifru6
impl Clone for __c_anonymous_ifr_ifru
impl Clone for semun
impl Clone for vec128_storage
impl<'a> Clone for Utf8Pattern<'a>
impl<'a> Clone for Component<'a>
impl<'a> Clone for Prefix<'a>
impl<'a> Clone for Unexpected<'a>
impl<'a> Clone for core::error::Source<'a>
impl<'a> Clone for core::ffi::c_str::Bytes<'a>
impl<'a> Clone for Arguments<'a>
impl<'a> Clone for PhantomContravariantLifetime<'a>
impl<'a> Clone for PhantomCovariantLifetime<'a>
impl<'a> Clone for PhantomInvariantLifetime<'a>
impl<'a> Clone for Location<'a>
impl<'a> Clone for EscapeAscii<'a>
impl<'a> Clone for core::str::iter::Bytes<'a>
impl<'a> Clone for CharIndices<'a>
impl<'a> Clone for Chars<'a>
impl<'a> Clone for EncodeUtf16<'a>
impl<'a> Clone for core::str::iter::EscapeDebug<'a>
impl<'a> Clone for core::str::iter::EscapeDefault<'a>
impl<'a> Clone for core::str::iter::EscapeUnicode<'a>
impl<'a> Clone for Lines<'a>
impl<'a> Clone for LinesAny<'a>
impl<'a> Clone for SplitAsciiWhitespace<'a>
impl<'a> Clone for SplitWhitespace<'a>
impl<'a> Clone for Utf8Chunk<'a>
impl<'a> Clone for Utf8Chunks<'a>
impl<'a> Clone for CharSearcher<'a>
impl<'a> Clone for IoSlice<'a>
impl<'a> Clone for Ancestors<'a>
impl<'a> Clone for Components<'a>
impl<'a> Clone for std::path::Iter<'a>
impl<'a> Clone for PrefixComponent<'a>
impl<'a, 'b> Clone for CharSliceSearcher<'a, 'b>
impl<'a, 'b> Clone for StrSearcher<'a, 'b>
impl<'a, 'b, const N: usize> Clone for CharArrayRefSearcher<'a, 'b, N>
impl<'a, E> Clone for BytesDeserializer<'a, E>
impl<'a, E> Clone for CowStrDeserializer<'a, E>
impl<'a, F> Clone for CharPredicateSearcher<'a, F>
impl<'a, K> Clone for alloc::collections::btree::set::Cursor<'a, K>where
K: Clone + 'a,
impl<'a, P> Clone for MatchIndices<'a, P>
impl<'a, P> Clone for Matches<'a, P>
impl<'a, P> Clone for RMatchIndices<'a, P>
impl<'a, P> Clone for RMatches<'a, P>
impl<'a, P> Clone for core::str::iter::RSplit<'a, P>
impl<'a, P> Clone for RSplitN<'a, P>
impl<'a, P> Clone for RSplitTerminator<'a, P>
impl<'a, P> Clone for core::str::iter::Split<'a, P>
impl<'a, P> Clone for core::str::iter::SplitInclusive<'a, P>
impl<'a, P> Clone for SplitN<'a, P>
impl<'a, P> Clone for SplitTerminator<'a, P>
impl<'a, T> Clone for RChunksExact<'a, T>
impl<'a, T> Clone for Slice<'a, T>where
T: Clone,
impl<'a, T, I> Clone for Ptr<'a, T, I>where
T: 'a + ?Sized,
I: Invariants<Aliasing = Shared>,
SAFETY: See the safety comment on Copy.
impl<'a, T, P> Clone for ChunkBy<'a, T, P>where
T: 'a,
P: Clone,
impl<'a, T, const N: usize> Clone for ArrayWindows<'a, T, N>where
T: Clone + 'a,
impl<'a, const N: usize> Clone for CharArraySearcher<'a, N>
impl<'de, E> Clone for BorrowedBytesDeserializer<'de, E>
impl<'de, E> Clone for BorrowedStrDeserializer<'de, E>
impl<'de, E> Clone for StrDeserializer<'de, E>
impl<'de, I, E> Clone for MapDeserializer<'de, I, E>
impl<'f> Clone for VaListImpl<'f>
impl<'fd> Clone for BorrowedFd<'fd>
impl<A> Clone for Repeat<A>where
A: Clone,
impl<A> Clone for RepeatN<A>where
A: Clone,
impl<A> Clone for core::option::IntoIter<A>where
A: Clone,
impl<A> Clone for core::option::Iter<'_, A>
impl<A> Clone for IterRange<A>where
A: Clone,
impl<A> Clone for IterRangeFrom<A>where
A: Clone,
impl<A> Clone for IterRangeInclusive<A>where
A: Clone,
impl<A> Clone for EnumAccessDeserializer<A>where
A: Clone,
impl<A> Clone for MapAccessDeserializer<A>where
A: Clone,
impl<A> Clone for SeqAccessDeserializer<A>where
A: Clone,
impl<A, B> Clone for Chain<A, B>
impl<A, B> Clone for Zip<A, B>
impl<B> Clone for Cow<'_, B>
impl<B, C> Clone for ControlFlow<B, C>
impl<B, T> Clone for Ref<B, T>
impl<Dyn> Clone for DynMetadata<Dyn>where
Dyn: ?Sized,
impl<E> Clone for BoolDeserializer<E>
impl<E> Clone for CharDeserializer<E>
impl<E> Clone for F32Deserializer<E>
impl<E> Clone for F64Deserializer<E>
impl<E> Clone for I8Deserializer<E>
impl<E> Clone for I16Deserializer<E>
impl<E> Clone for I32Deserializer<E>
impl<E> Clone for I64Deserializer<E>
impl<E> Clone for I128Deserializer<E>
impl<E> Clone for IsizeDeserializer<E>
impl<E> Clone for StringDeserializer<E>
impl<E> Clone for U8Deserializer<E>
impl<E> Clone for U16Deserializer<E>
impl<E> Clone for U32Deserializer<E>
impl<E> Clone for U64Deserializer<E>
impl<E> Clone for U128Deserializer<E>
impl<E> Clone for UnitDeserializer<E>
impl<E> Clone for UsizeDeserializer<E>
impl<F> Clone for FromFn<F>where
F: Clone,
impl<F> Clone for OnceWith<F>where
F: Clone,
impl<F> Clone for RepeatWith<F>where
F: Clone,
impl<G> Clone for FromCoroutine<G>where
G: Clone,
impl<H> Clone for BuildHasherDefault<H>
impl<I> Clone for FromIter<I>where
I: Clone,
impl<I> Clone for DecodeUtf16<I>
impl<I> Clone for Cloned<I>where
I: Clone,
impl<I> Clone for Copied<I>where
I: Clone,
impl<I> Clone for Cycle<I>where
I: Clone,
impl<I> Clone for Enumerate<I>where
I: Clone,
impl<I> Clone for Fuse<I>where
I: Clone,
impl<I> Clone for Intersperse<I>
impl<I> Clone for Peekable<I>
impl<I> Clone for Skip<I>where
I: Clone,
impl<I> Clone for StepBy<I>where
I: Clone,
impl<I> Clone for Take<I>where
I: Clone,
impl<I, E> Clone for SeqDeserializer<I, E>
impl<I, F> Clone for FilterMap<I, F>
impl<I, F> Clone for Inspect<I, F>
impl<I, F> Clone for Map<I, F>
impl<I, F, const N: usize> Clone for MapWindows<I, F, N>
impl<I, G> Clone for IntersperseWith<I, G>
impl<I, P> Clone for Filter<I, P>
impl<I, P> Clone for MapWhile<I, P>
impl<I, P> Clone for SkipWhile<I, P>
impl<I, P> Clone for TakeWhile<I, P>
impl<I, St, F> Clone for Scan<I, St, F>
impl<I, U> Clone for Flatten<I>
impl<I, U, F> Clone for FlatMap<I, U, F>
impl<I, const N: usize> Clone for ArrayChunks<I, N>
impl<Idx> Clone for core::ops::range::Range<Idx>where
Idx: Clone,
impl<Idx> Clone for core::ops::range::RangeFrom<Idx>where
Idx: Clone,
impl<Idx> Clone for core::ops::range::RangeInclusive<Idx>where
Idx: Clone,
impl<Idx> Clone for RangeTo<Idx>where
Idx: Clone,
impl<Idx> Clone for core::ops::range::RangeToInclusive<Idx>where
Idx: Clone,
impl<Idx> Clone for core::range::Range<Idx>where
Idx: Clone,
impl<Idx> Clone for core::range::RangeFrom<Idx>where
Idx: Clone,
impl<Idx> Clone for core::range::RangeInclusive<Idx>where
Idx: Clone,
impl<Idx> Clone for core::range::RangeToInclusive<Idx>where
Idx: Clone,
impl<K> Clone for std::collections::hash::set::Iter<'_, K>
impl<K, V> Clone for alloc::collections::btree::map::Cursor<'_, K, V>
impl<K, V> Clone for alloc::collections::btree::map::Iter<'_, K, V>
impl<K, V> Clone for alloc::collections::btree::map::Keys<'_, K, V>
impl<K, V> Clone for alloc::collections::btree::map::Range<'_, K, V>
impl<K, V> Clone for alloc::collections::btree::map::Values<'_, K, V>
impl<K, V> Clone for std::collections::hash::map::Iter<'_, K, V>
impl<K, V> Clone for std::collections::hash::map::Keys<'_, K, V>
impl<K, V> Clone for std::collections::hash::map::Values<'_, K, V>
impl<K, V, A> Clone for BTreeMap<K, V, A>
impl<K, V, S> Clone for HashMap<K, V, S>
impl<O> Clone for F32<O>where
O: Clone,
impl<O> Clone for F64<O>where
O: Clone,
impl<O> Clone for I16<O>where
O: Clone,
impl<O> Clone for I32<O>where
O: Clone,
impl<O> Clone for I64<O>where
O: Clone,
impl<O> Clone for I128<O>where
O: Clone,
impl<O> Clone for Isize<O>where
O: Clone,
impl<O> Clone for U16<O>where
O: Clone,
impl<O> Clone for U32<O>where
O: Clone,
impl<O> Clone for U64<O>where
O: Clone,
impl<O> Clone for U128<O>where
O: Clone,
impl<O> Clone for Usize<O>where
O: Clone,
impl<Ptr> Clone for Pin<Ptr>where
Ptr: Clone,
impl<R> Clone for BlockRng64<R>
impl<R> Clone for BlockRng<R>
impl<R, Rsdr> Clone for ReseedingRng<R, Rsdr>
impl<T> !Clone for &mut Twhere
T: ?Sized,
Shared references can be cloned, but mutable references cannot!
impl<T> Clone for Option<T>where
T: Clone,
impl<T> Clone for Bound<T>where
T: Clone,
impl<T> Clone for Poll<T>where
T: Clone,
impl<T> Clone for SendTimeoutError<T>where
T: Clone,
impl<T> Clone for std::sync::mpsc::TrySendError<T>where
T: Clone,
impl<T> Clone for *const Twhere
T: ?Sized,
impl<T> Clone for *mut Twhere
T: ?Sized,
impl<T> Clone for &Twhere
T: ?Sized,
Shared references can be cloned, but mutable references cannot!