Skip to content

Commit

Permalink
fix: updated now-proto-api
Browse files Browse the repository at this point in the history
  • Loading branch information
pacmancoder committed Sep 30, 2024
1 parent a002057 commit fa236e3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion crates/now-proto-pdu/src/core/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ mod number;
mod status;
mod string;

pub(crate) use header::{NowHeader, NowMessageClass};
pub use header::{NowHeader, NowMessageClass};

pub use buffer::{NowLrgBuf, NowVarBuf};
pub use number::{VarI16, VarI32, VarI64, VarU16, VarU32, VarU64};
Expand Down
5 changes: 5 additions & 0 deletions crates/now-proto-pdu/src/message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,12 @@ impl Encode for NowMessage {
impl Decode<'_> for NowMessage {
fn decode(src: &mut ReadCursor<'_>) -> DecodeResult<Self> {
let header = NowHeader::decode(src)?;
Self::decode_from_body(header, src)
}
}

impl NowMessage {
pub fn decode_from_body(header: NowHeader, src: &mut ReadCursor<'_>) -> DecodeResult<Self> {
match NowMessageClass(header.class.0) {
NowMessageClass::SYSTEM => Ok(Self::System(NowSystemMessage::decode_from_body(header, src)?)),
NowMessageClass::SESSION => Ok(Self::Session(NowSessionMessage::decode_from_body(header, src)?)),
Expand Down

0 comments on commit fa236e3

Please sign in to comment.