buss_protocol/types/mod.rs
1use crate::ToBytes;
2
3/// String representing what path the request is for
4pub struct BussPath {
5 path: String,
6}
7
8impl BussPath {
9 /// creates a new path
10 pub fn new(path: &str) -> Self {
11 Self {
12 path: String::from(path),
13 }
14 }
15}
16
17impl ToBytes for BussPath {
18 fn to_bytes(self) -> Vec<u8> {
19 let mut bytes = Vec::new();
20 bytes.extend(self.path.len().to_be_bytes().iter());
21 bytes.extend(self.path.into_bytes().iter());
22 bytes
23 }
24}
25
26pub mod buss_flags {
27 /// Treat strings as utf16
28 pub const UTF16: u8 = 0b00000001;
29}