@@ -46,8 +46,8 @@ fn identifier_is_valid(id: &str) -> bool {
4646pub struct IpAddr ( pub smoltcp_nal:: smoltcp:: wire:: Ipv4Address ) ;
4747
4848impl IpAddr {
49- pub fn new ( bytes : & [ u8 ] ) -> Self {
50- Self ( smoltcp:: wire:: Ipv4Address :: from_bytes ( bytes ) )
49+ pub fn new ( a : u8 , b : u8 , c : u8 , d : u8 ) -> Self {
50+ Self ( smoltcp:: wire:: Ipv4Address :: new ( a , b , c , d ) )
5151 }
5252}
5353
@@ -78,11 +78,11 @@ impl encdec::Encode for IpAddr {
7878 type Error = encdec:: Error ;
7979
8080 fn encode_len ( & self ) -> Result < usize , Self :: Error > {
81- Ok ( self . 0 . 0 . len ( ) )
81+ Ok ( self . 0 . octets ( ) . len ( ) )
8282 }
8383
8484 fn encode ( & self , buff : & mut [ u8 ] ) -> Result < usize , Self :: Error > {
85- self . 0 . 0 . encode ( buff)
85+ self . 0 . octets ( ) . encode ( buff)
8686 }
8787}
8888
@@ -91,8 +91,8 @@ impl encdec::DecodeOwned for IpAddr {
9191 type Error = encdec:: Error ;
9292
9393 fn decode_owned ( buff : & [ u8 ] ) -> Result < ( Self :: Output , usize ) , Self :: Error > {
94- let ( data , size) = <[ u8 ; 4 ] >:: decode_owned ( buff) ?;
95- Ok ( ( Self :: new ( & data [ .. ] ) , size) )
94+ let ( [ a , b , c , d ] , size) = <[ u8 ; 4 ] >:: decode_owned ( buff) ?;
95+ Ok ( ( Self :: new ( a , b , c , d ) , size) )
9696 }
9797}
9898
0 commit comments