Skip to content

Commit 9e2ac1f

Browse files
committed
timeuuid: add missing delegate methods
1 parent abc8d28 commit 9e2ac1f

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed

scylla-cql/src/frame/value.rs

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,54 @@ impl CqlTimeuuid {
6363
pub fn as_bytes(&self) -> &[u8; 16] {
6464
self.0.as_bytes()
6565
}
66+
67+
pub fn as_u128(&self) -> u128 {
68+
self.0.as_u128()
69+
}
70+
71+
pub fn as_fields(&self) -> (u32, u16, u16, &[u8; 8]) {
72+
self.0.as_fields()
73+
}
74+
75+
pub fn as_u64_pair(&self) -> (u64, u64) {
76+
self.0.as_u64_pair()
77+
}
78+
79+
pub fn from_slice(b: &[u8]) -> Result<Self, uuid::Error> {
80+
Ok(Self(Uuid::from_slice(b)?))
81+
}
82+
83+
pub fn from_slice_le(b: &[u8]) -> Result<Self, uuid::Error> {
84+
Ok(Self(Uuid::from_slice_le(b)?))
85+
}
86+
87+
pub fn from_bytes(bytes: [u8; 16]) -> Self {
88+
Self(Uuid::from_bytes(bytes))
89+
}
90+
91+
pub fn from_bytes_le(bytes: [u8; 16]) -> Self {
92+
Self(Uuid::from_bytes_le(bytes))
93+
}
94+
95+
pub fn from_fields(d1: u32, d2: u16, d3: u16, d4: &[u8; 8]) -> Self {
96+
Self(Uuid::from_fields(d1, d2, d3, d4))
97+
}
98+
99+
pub fn from_fields_le(d1: u32, d2: u16, d3: u16, d4: &[u8; 8]) -> Self {
100+
Self(Uuid::from_fields_le(d1, d2, d3, d4))
101+
}
102+
103+
pub fn from_u128(v: u128) -> Self {
104+
Self(Uuid::from_u128(v))
105+
}
106+
107+
pub fn from_u128_le(v: u128) -> Self {
108+
Self(Uuid::from_u128_le(v))
109+
}
110+
111+
pub fn from_u64_pair(high_bits: u64, low_bits: u64) -> Self {
112+
Self(Uuid::from_u64_pair(high_bits, low_bits))
113+
}
66114
}
67115

68116
impl CqlTimeuuid {

0 commit comments

Comments
 (0)