diff --git a/src/sql/value/value.rs b/src/sql/value/value.rs index 2da461b2..2e79e557 100644 --- a/src/sql/value/value.rs +++ b/src/sql/value/value.rs @@ -386,6 +386,18 @@ impl From> for Value { } } +impl Into> for Value { + fn into(self) -> Vec { + serde_cbor::to_vec(&self).unwrap() + } +} + +impl From> for Value { + fn from(v: Vec) -> Self { + serde_cbor::from_slice::(&v).unwrap() + } +} + impl Value { // ----------------------------------- // Initial record value @@ -600,6 +612,10 @@ impl Value { .into() } + pub fn to_vec(&self) -> Result, Error> { + serde_cbor::to_vec(&self).map_err(|e| e.into()) + } + // ----------------------------------- // Value operations // -----------------------------------