From 5517af8b9775b827aa386495941dee733673bbc3 Mon Sep 17 00:00:00 2001 From: folex <0xdxdy@gmail.com> Date: Mon, 13 Jul 2020 16:13:03 +0300 Subject: [PATCH] Remove Default from Vec1, add into_vec --- src/vec1.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/vec1.rs b/src/vec1.rs index b970fd0..2d203c2 100644 --- a/src/vec1.rs +++ b/src/vec1.rs @@ -9,7 +9,7 @@ use serde::{Serialize, Deserialize}; /// `Vec1` represents a non-empty `Vec`. It derefs to `Vec` /// directly. -#[derive(Clone, PartialEq, Serialize, Deserialize, Default)] +#[derive(Clone, PartialEq, Serialize, Deserialize)] pub struct Vec1(Vec) where T: Debug; @@ -40,6 +40,11 @@ where Ok(Self(items)) } } + + /// Converts this Vec1 into Vec + pub fn into_vec(self) -> Vec { + self.0 + } } impl fmt::Debug for Vec1