cel_cxx/values/impls/
bytes.rs

1use super::{impl_from, impl_into, impl_typed};
2use crate::{types::*, values::*};
3
4impl_typed!(
5    Bytes: Value {
6        BytesValue,
7        Vec<u8>,
8        Box<[u8]>,
9        [u8]
10    }
11);
12
13impl_into!(
14    Bytes: Value, Constant {
15        BytesValue => |self| self,
16        Vec<u8> => |self| self.into(),
17        Box<[u8]> => |self| self.into(),
18        &[u8] => |self| self.into(),
19    }
20);
21
22impl_from!(
23    Bytes: Value {
24        BytesValue => |v| v.clone(),
25        Vec<u8> => |v| v.to_vec(),
26        Box<[u8]> => |v| Box::from(v.as_slice()),
27        &BytesValue as &'a BytesValue => |v| v,
28        &[u8] as &'a [u8] => |v| v.as_slice(),
29    }
30);