Skip to content

Commit 2b9f662

Browse files
xyzzyzctz
authored andcommitted
Add From<[u8; 4]> for Ipv4Addr
1 parent 1bc73dc commit 2b9f662

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/server_name.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -446,6 +446,12 @@ impl From<std::net::Ipv6Addr> for IpAddr {
446446
#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)]
447447
pub struct Ipv4Addr([u8; 4]);
448448

449+
impl From<[u8; 4]> for Ipv4Addr {
450+
fn from(value: [u8; 4]) -> Self {
451+
Self(value)
452+
}
453+
}
454+
449455
impl TryFrom<&str> for Ipv4Addr {
450456
type Error = AddrParseError;
451457

0 commit comments

Comments
 (0)