cassandra_protocol/types/
blob.rs1use derive_more::Constructor;
2
3#[derive(PartialEq, Eq, Hash, Debug, Clone, Constructor)]
5#[repr(transparent)]
6pub struct Blob(Vec<u8>);
7
8impl Blob {
9 #[inline]
11 pub fn as_mut_slice(&mut self) -> &[u8] {
12 self.0.as_mut_slice()
13 }
14
15 #[inline]
17 pub fn into_vec(self) -> Vec<u8> {
18 self.0
19 }
20}
21
22impl From<Vec<u8>> for Blob {
23 #[inline]
24 fn from(vec: Vec<u8>) -> Self {
25 Blob::new(vec)
26 }
27}
28
29impl From<&[u8]> for Blob {
30 #[inline]
31 fn from(value: &[u8]) -> Self {
32 Blob::new(value.to_vec())
33 }
34}