Resolve "Encapsulation of messages"
4 unresolved threads
4 unresolved threads
Closes #1 (closed)
Merge request reports
Activity
Filter activity
- src/error.rs 0 → 100644
3 use serde::{de, ser}; 4 5 #[derive(Debug, PartialEq, Eq)] 6 pub enum Error { 7 Message(String), 8 } 9 10 impl std::error::Error for Error {} 11 12 impl Display for Error { 13 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 14 match self { 15 Error::Message(msg) => write!(f, "Error : {}", msg), 16 } 17 } 18 } changed this line in version 2 of the diff
19 19 20 20 clap = { version = "4.0", features = ["derive"] } 21 21 22 serde = "1.0.152" You should only put
serde = "1"
as versions use semantic versioning.changed this line in version 2 of the diff
- src/messages.rs 0 → 100644
19 } 20 21 /// MIRC message structure 22 #[derive(Debug, PartialEq, Eq)] 23 pub struct Message<'a> { 24 /// Has to be equal to 95 to be correct 25 pub magic: u8, 26 27 /// Has to be equal to 0 28 pub version: u8, 29 30 /// List of TLV 31 pub body: Body<'a>, 32 } 33 34 pub type Body<'a> = Vec<TLV<'a>>; changed this line in version 2 of the diff
Can you format + fix clippy issues, in order to get pipeline coverage report
Edited by v-lafeychine- src/messages.rs 0 → 100644
8 9 use crate::{ 10 error::Error, 11 serialization::ByteString, 12 visitors::{SeqVisitor, U64Visitor, U8Visitor}, 13 }; 14 15 /// Trait indicating that it is possible to obtain the length of its byte representation 16 trait ByteLength { 17 /// Return the length of its byte representation 18 fn byte_length(&self) -> usize; 19 } 20 21 /// MIRC message structure 22 #[derive(Debug, PartialEq, Eq)] 23 pub struct Message<'a> { changed this line in version 2 of the diff
I think a little refactor has to be done.
payload/mod.rs
:trait ByteLength
payload/serializer.rs
payload/visitors.rs
payload/message.rs
:pub struct Message impl Default for Message<'_> impl<'_> Message<'_> impl Serialize for Message
payload/tlv/mod.rs
:pub enum TLV impl TLV<'_> impl Serialize for TLV<'_> impl Deserialize<'_> for TLV<'_> trait TLV: Serialize + Deserialize
And, for each TLV
t
inmessage/tlv/t.rs
:impl ByteLength for t impl Serialize for t impl Deserialize for t impl TLV for t
Edited by v-lafeychineadded 1 commit
- ac0785b2 - feat: End of serialization/deserialization before refactor
added 1 commit
- fa32b56c - chore: Refactor in progress : complete for Pad1 and PadN
assigned to @pigeonmoelleux
mentioned in commit 03c64c4c