MCPcopy Create free account
hub / github.com/ImageOptim/libimagequant / clone

Method clone

src/seacow.rs:67–78  ·  view source on GitHub ↗
(&self)

Source from the content-addressed store, hash-verified

65impl<T: Clone> Clone for SeaCowInner<'_, T> {
66 #[inline(never)]
67 fn clone(&self) -> Self {
68 let slice = match self {
69 Self::Borrowed(data) => return Self::Borrowed(data),
70 #[cfg(feature = "_internal_c_ffi")]
71 Self::Owned { ptr, len, free_fn: _ } => unsafe { std::slice::from_raw_parts(*ptr, *len) },
72 Self::Boxed(data) => &**data,
73 };
74 let mut v = Vec::new();
75 v.try_reserve_exact(slice.len()).unwrap();
76 v.extend_from_slice(slice);
77 Self::Boxed(v.into_boxed_slice())
78 }
79}
80
81enum SeaCowInner<'a, T> {

Callers

nothing calls this directly

Calls 2

newFunction · 0.85
lenMethod · 0.45

Tested by

no test coverage detected