cl_aux/structures/
single_item_storage.rs1use core::slice;
2
3#[derive(Debug, Default, Eq, PartialEq, PartialOrd)]
7pub struct SingleItemStorage<T>(
8 pub T,
10);
11
12impl<T> AsMut<[T]> for SingleItemStorage<T> {
13 #[inline]
14 fn as_mut(&mut self) -> &mut [T] {
15 slice::from_mut(&mut self.0)
16 }
17}
18
19impl<T> AsRef<[T]> for SingleItemStorage<T> {
20 #[inline]
21 fn as_ref(&self) -> &[T] {
22 slice::from_ref(&self.0)
23 }
24}
25
26impl<T> From<T> for SingleItemStorage<T> {
27 #[inline]
28 fn from(from: T) -> Self {
29 Self(from)
30 }
31}