Remove Default from Vec1, add into_vec

This commit is contained in:
folex 2020-07-13 16:13:03 +03:00
parent 689c6757fb
commit 5517af8b97

View File

@ -9,7 +9,7 @@ use serde::{Serialize, Deserialize};
/// `Vec1<T>` represents a non-empty `Vec<T>`. It derefs to `Vec<T>`
/// directly.
#[derive(Clone, PartialEq, Serialize, Deserialize, Default)]
#[derive(Clone, PartialEq, Serialize, Deserialize)]
pub struct Vec1<T>(Vec<T>)
where
T: Debug;
@ -40,6 +40,11 @@ where
Ok(Self(items))
}
}
/// Converts this Vec1 into Vec
pub fn into_vec(self) -> Vec<T> {
self.0
}
}
impl<T> fmt::Debug for Vec1<T>