Skip to main content

velr_types/
storage.rs

1#[derive(Debug, Clone, PartialEq)]
2pub enum StorageValue {
3    Null,
4    Integer(i64),
5    Real(f64),
6    Text(String),
7    Blob(Vec<u8>),
8}
9
10#[derive(Debug, Copy, Clone, PartialEq)]
11pub enum StorageValueRef<'a> {
12    Null,
13    Integer(i64),
14    Real(f64),
15    Text(&'a str),
16    Blob(&'a [u8]),
17}
18
19impl StorageValue {
20    pub fn as_ref(&self) -> StorageValueRef<'_> {
21        match self {
22            Self::Null => StorageValueRef::Null,
23            Self::Integer(v) => StorageValueRef::Integer(*v),
24            Self::Real(v) => StorageValueRef::Real(*v),
25            Self::Text(v) => StorageValueRef::Text(v),
26            Self::Blob(v) => StorageValueRef::Blob(v),
27        }
28    }
29}