1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
use std::io::Cursor;
use crate::error;
use crate::query;
pub trait IntoBytes {
fn into_cbytes(&self) -> Vec<u8>;
}
pub trait FromBytes {
fn from_bytes(bytes: &[u8]) -> error::Result<Self>
where
Self: Sized;
}
pub trait AsByte {
fn as_byte(&self) -> u8;
}
pub trait FromSingleByte {
fn from_byte(byte: u8) -> Self;
}
pub trait FromCursor {
fn from_cursor(cursor: &mut Cursor<&[u8]>) -> error::Result<Self>
where
Self: Sized;
}
pub trait IntoQueryValues {
fn into_query_values(self) -> query::QueryValues;
}
pub trait TryFromRow: Sized {
fn try_from_row(row: crate::types::rows::Row) -> error::Result<Self>;
}
pub trait TryFromUDT: Sized {
fn try_from_udt(udt: crate::types::udt::UDT) -> error::Result<Self>;
}