1use alloc::vec::Vec;
2
3#[derive(Clone, Debug, PartialOrd, Ord, PartialEq, Eq, Hash)]
6pub struct Any {
7 pub(crate) contents: Vec<u8>,
8}
9
10impl Any {
11 pub fn new(contents: Vec<u8>) -> Self {
13 Self { contents }
14 }
15
16 pub fn as_bytes(&self) -> &[u8] {
18 &self.contents
19 }
20
21 pub fn into_bytes(self) -> Vec<u8> {
23 self.contents
24 }
25}
26
27impl AsRef<[u8]> for Any {
28 fn as_ref(&self) -> &[u8] {
29 self.contents.as_ref()
30 }
31}
32
33impl From<Vec<u8>> for Any {
34 fn from(value: Vec<u8>) -> Self {
35 Any::new(value)
36 }
37}