Skip to content

Commit

Permalink
Merge pull request #232 from TheNeikos/feature/add_parse_complete
Browse files Browse the repository at this point in the history
Add parse_complete method for MqttPacket
  • Loading branch information
TheNeikos authored Mar 20, 2024
2 parents db568c4 + 08eaade commit 8ea3e0c
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions mqtt-format/src/v5/packets/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
//

use winnow::error::ContextError;
use winnow::error::ErrMode;
use winnow::Bytes;
use winnow::Parser;

Expand Down Expand Up @@ -96,6 +98,10 @@ impl<'i> MqttPacket<'i> {
})
.parse_next(input)
}

pub fn parse_complete(input: &'i [u8]) -> Result<Self, ErrMode<ContextError>> {
Self::parse(&mut Bytes::new(input))
}
}

macro_rules! impl_try_from_packet {
Expand Down

0 comments on commit 8ea3e0c

Please sign in to comment.