@@ -40,7 +40,6 @@ use core::convert::TryInto;
40
40
use core:: fmt;
41
41
use core:: fmt:: Debug ;
42
42
use core:: str:: FromStr ;
43
- use std:: net:: { AddrParseError , Ipv4Addr , Ipv6Addr , SocketAddr } ;
44
43
use crate :: io:: { self , Read } ;
45
44
use crate :: io_extras:: read_to_end;
46
45
@@ -895,19 +894,20 @@ impl Readable for NetAddress {
895
894
}
896
895
}
897
896
897
+ #[ cfg( feature = "std" ) ]
898
898
impl FromStr for NetAddress {
899
- type Err = AddrParseError ;
899
+ type Err = std :: net :: AddrParseError ;
900
900
901
901
fn from_str ( s : & str ) -> Result < Self , Self :: Err > {
902
- match SocketAddr :: from_str ( s) {
902
+ match std :: net :: SocketAddr :: from_str ( s) {
903
903
Ok ( addr) => {
904
904
let port: u16 = addr. port ( ) ;
905
905
match addr {
906
- SocketAddr :: V4 ( addr) => {
906
+ std :: net :: SocketAddr :: V4 ( addr) => {
907
907
let addr = addr. ip ( ) . octets ( ) ;
908
908
return Ok ( NetAddress :: IPv4 { addr, port } ) ;
909
909
} ,
910
- SocketAddr :: V6 ( addr) => {
910
+ std :: net :: SocketAddr :: V6 ( addr) => {
911
911
let addr = addr. ip ( ) . octets ( ) ;
912
912
return Ok ( NetAddress :: IPv6 { addr, port } ) ;
913
913
} ,
@@ -2472,7 +2472,7 @@ impl_writeable_msg!(GossipTimestampFilter, {
2472
2472
timestamp_range,
2473
2473
} , { } ) ;
2474
2474
2475
- #[ cfg( test) ]
2475
+ #[ cfg( all ( test, not ( feature = "no-std" ) ) ) ]
2476
2476
mod tests {
2477
2477
use bitcoin:: { Transaction , PackedLockTime , TxIn , Script , Sequence , Witness , TxOut } ;
2478
2478
use hex;
0 commit comments