aboutsummaryrefslogtreecommitdiff
path: root/src/primitive/unsignedint.rs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/primitive/unsignedint.rs (renamed from src/protocol/primitive/unsignedint.rs)24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/protocol/primitive/unsignedint.rs b/src/primitive/unsignedint.rs
index 5b42e3c..6e91e2a 100644
--- a/src/protocol/primitive/unsignedint.rs
+++ b/src/primitive/unsignedint.rs
@@ -7,10 +7,10 @@ use std::vec::Vec;
use failure::Error;
-use crate::protocol::error::ProtocolError;
-use crate::protocol::primitive::{deserialize, serialize};
+use crate::error::ProtocolError;
+use crate::{Deserialize, Serialize};
-impl serialize::Serialize for bool {
+impl Serialize for bool {
fn serialize(&self) -> Result<Vec<u8>, Error> {
Ok({
let i = *self as i8;
@@ -18,7 +18,7 @@ impl serialize::Serialize for bool {
})
}
}
-impl deserialize::Deserialize for bool {
+impl Deserialize for bool {
fn parse(b: &[u8]) -> Result<(usize, Self), Error> {
if b[0] == 0 {
return Ok((1, false));
@@ -29,52 +29,52 @@ impl deserialize::Deserialize for bool {
};
}
}
-impl serialize::Serialize for u64 {
+impl Serialize for u64 {
fn serialize(&self) -> Result<Vec<u8>, Error> {
Ok(Vec::from(self.to_be_bytes()))
}
}
-impl deserialize::Deserialize for u64 {
+impl Deserialize for u64 {
fn parse(b: &[u8]) -> Result<(usize, Self), Error> {
let mut rdr = Cursor::new(&b[0..8]);
return Ok((8, rdr.read_u64::<BigEndian>()?));
}
}
-impl serialize::Serialize for u32 {
+impl Serialize for u32 {
fn serialize(&self) -> Result<Vec<u8>, Error> {
Ok(Vec::from(self.to_be_bytes()))
}
}
-impl deserialize::Deserialize for u32 {
+impl Deserialize for u32 {
fn parse(b: &[u8]) -> Result<(usize, Self), Error> {
let mut rdr = Cursor::new(&b[0..4]);
return Ok((4, rdr.read_u32::<BigEndian>()?));
}
}
-impl serialize::Serialize for u16 {
+impl Serialize for u16 {
fn serialize(&self) -> Result<Vec<u8>, Error> {
Ok(Vec::from(self.to_be_bytes()))
}
}
-impl deserialize::Deserialize for u16 {
+impl Deserialize for u16 {
fn parse(b: &[u8]) -> Result<(usize, Self), Error> {
let mut rdr = Cursor::new(&b[0..2]);
return Ok((2, rdr.read_u16::<BigEndian>()?));
}
}
-impl serialize::Serialize for u8 {
+impl Serialize for u8 {
fn serialize(&self) -> Result<Vec<u8>, Error> {
Ok(Vec::from(self.to_be_bytes()))
}
}
-impl deserialize::Deserialize for u8 {
+impl Deserialize for u8 {
fn parse(b: &[u8]) -> Result<(usize, Self), Error> {
return Ok((1, b[0]));
}
9de7e209b45&follow=1'>fix init container nameMax Audron-1/+1 2021-06-05fix tanka dependency pathMax Audron-8/+8 2021-06-05switch to https url for tanka util libMax Audron-2/+2 2021-06-05bump version to 1.0.2Max Audron-2/+2 2021-06-05add tanka ci configurationMax Audron-1/+1 2021-06-05ready tanka deploy for CIMax Audron-32/+69 2021-06-05remove tanka vendoringMax Audron-27651/+0 2021-05-26Release 1.0.1Max Audron-3/+3 2021-05-26fix log breaking once buffer fullMax Audron-2/+33 the log_msg function was poping the newest message and replacing it with the newest message, it should be poping the oldest messages. 2021-05-16add deployment stuffMax Audron-6/+27786 2021-05-15add container buildMax Audron-2/+35 30f1855ec194703bfb0fdac22de9e18eaa5237&follow=1'>add basic network syncablesMax Audron-39/+420 2025-02-23clean up unused_import and unused_variables a bitMax Audron-2/+8 2025-02-23fix server feature errorsMax Audron-28/+23 2025-02-23fix ircchannel and maplist network representationMax Audron-154/+137 2025-02-22replace deprecated failure crate with thiserrorMax Audron-278/+194 this changes the public API in that all our methods now return a proper ProtocolError crate. Needed change anyways to properly deal with all our errors in the long run. Will still need to do a pass through the crate to remove all existing unwraps where it makes sense. 2025-02-22update dependencies and fix errorsMax Audron-508/+332 2025-02-22update flakeMax Audron-94/+117 2024-05-22add todos to readmeMax Audron-16/+35