diff options
| author | luwenpeng <[email protected]> | 2023-08-14 11:03:42 +0800 |
|---|---|---|
| committer | luwenpeng <[email protected]> | 2023-08-14 11:03:42 +0800 |
| commit | 53e184805feabca2724841dcf45f356d427ea6e6 (patch) | |
| tree | a81915365369350eb007ff3a0f645cbc84bdc4d3 /src/protocol/ip.rs | |
| parent | 85973cd021fda0d62c5f3e786e2abb8c8296a1df (diff) | |
[feature] Add Decode trait
Diffstat (limited to 'src/protocol/ip.rs')
| -rw-r--r-- | src/protocol/ip.rs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/protocol/ip.rs b/src/protocol/ip.rs index 3a2f6bd..1b92494 100644 --- a/src/protocol/ip.rs +++ b/src/protocol/ip.rs @@ -1,3 +1,4 @@ +use crate::protocol::codec::Decode; use nom::number; use nom::IResult; @@ -62,8 +63,8 @@ impl From<u8> for IPProtocol { } } -impl IPProtocol { - pub fn decode(input: &[u8]) -> IResult<&[u8], IPProtocol> { +impl Decode<IPProtocol> for IPProtocol { + fn decode(input: &[u8]) -> IResult<&[u8], IPProtocol> { let (input, protocol) = number::streaming::be_u8(input)?; Ok((input, protocol.into())) |
