1pub use crate::types::bytes::Bytes;
2
3#[derive(Debug, Clone, PartialEq, Eq)]
22pub struct Blob(pub Bytes);
23
24impl Blob {
25 pub fn as_slice(&self) -> &[u8] {
26 self.as_ref()
27 }
28}
29
30#[derive(Debug, Clone, PartialEq, Eq)]
42pub struct Clob(pub Bytes);
43
44impl Clob {
45 pub fn as_slice(&self) -> &[u8] {
46 self.as_ref()
47 }
48}
49
50impl AsRef<[u8]> for Blob {
51 fn as_ref(&self) -> &[u8] {
52 self.0.as_ref()
53 }
54}
55
56impl AsRef<[u8]> for Clob {
57 fn as_ref(&self) -> &[u8] {
58 self.0.as_ref()
59 }
60}
61
62impl PartialEq<[u8]> for Blob {
63 fn eq(&self, other: &[u8]) -> bool {
64 self.as_ref().eq(other)
65 }
66}
67
68impl PartialEq<[u8]> for Clob {
69 fn eq(&self, other: &[u8]) -> bool {
70 self.as_ref().eq(other)
71 }
72}
73
74impl From<Blob> for Bytes {
75 fn from(blob: Blob) -> Self {
76 blob.0
77 }
78}
79
80impl From<Clob> for Bytes {
81 fn from(clob: Clob) -> Self {
82 clob.0
83 }
84}
85
86impl From<Vec<u8>> for Blob {
87 fn from(data: Vec<u8>) -> Self {
88 let bytes: Bytes = data.into();
89 Blob(bytes)
90 }
91}
92
93impl From<Vec<u8>> for Clob {
94 fn from(data: Vec<u8>) -> Self {
95 let bytes: Bytes = data.into();
96 Clob(bytes)
97 }
98}
99
100impl From<&[u8]> for Blob {
101 fn from(data: &[u8]) -> Self {
102 Blob::from(data.to_vec())
103 }
104}
105
106impl From<&[u8]> for Clob {
107 fn from(data: &[u8]) -> Self {
108 Clob::from(data.to_vec())
109 }
110}
111
112impl From<&str> for Blob {
113 fn from(text: &str) -> Self {
114 text.as_bytes().into()
115 }
116}
117
118impl From<&str> for Clob {
119 fn from(text: &str) -> Self {
120 text.as_bytes().into()
121 }
122}