pub struct Ipv4Addr {
octets: [u8; 4],
}
Expand description
An IPv4 address.
IPv4 addresses are defined as 32-bit integers in IETF RFC 791. They are usually represented as four octets.
See IpAddr
for a type encompassing both IPv4 and IPv6 addresses.
ยงTextual representation
Ipv4Addr
provides a FromStr
implementation. The four octets are in decimal
notation, divided by .
(this is called โdot-decimal notationโ).
Notably, octal numbers (which are indicated with a leading 0
) and hexadecimal numbers (which
are indicated with a leading 0x
) are not allowed per IETF RFC 6943.
ยงExamples
use std::net::Ipv4Addr;
let localhost = Ipv4Addr::new(127, 0, 0, 1);
assert_eq!("127.0.0.1".parse(), Ok(localhost));
assert_eq!(localhost.is_loopback(), true);
assert!("012.004.002.000".parse::<Ipv4Addr>().is_err()); // all octets are in octal
assert!("0000000.0.0.0".parse::<Ipv4Addr>().is_err()); // first octet is a zero in octal
assert!("0xcb.0x0.0x71.0x00".parse::<Ipv4Addr>().is_err()); // all octets are in hex
Fieldsยง
ยงoctets: [u8; 4]
Implementationsยง
Sourceยงimpl Ipv4Addr
impl Ipv4Addr
1.80.0 ยท Sourcepub const BITS: u32 = 32u32
pub const BITS: u32 = 32u32
The size of an IPv4 address in bits.
ยงExamples
use std::net::Ipv4Addr;
assert_eq!(Ipv4Addr::BITS, 32);
1.30.0 ยท Sourcepub const LOCALHOST: Ipv4Addr
pub const LOCALHOST: Ipv4Addr
An IPv4 address with the address pointing to localhost: 127.0.0.1
ยงExamples
use std::net::Ipv4Addr;
let addr = Ipv4Addr::LOCALHOST;
assert_eq!(addr, Ipv4Addr::new(127, 0, 0, 1));
1.30.0 ยท Sourcepub const UNSPECIFIED: Ipv4Addr
pub const UNSPECIFIED: Ipv4Addr
An IPv4 address representing an unspecified address: 0.0.0.0
This corresponds to the constant INADDR_ANY
in other languages.
ยงExamples
use std::net::Ipv4Addr;
let addr = Ipv4Addr::UNSPECIFIED;
assert_eq!(addr, Ipv4Addr::new(0, 0, 0, 0));
1.30.0 ยท Sourcepub const BROADCAST: Ipv4Addr
pub const BROADCAST: Ipv4Addr
An IPv4 address representing the broadcast address: 255.255.255.255
.
ยงExamples
use std::net::Ipv4Addr;
let addr = Ipv4Addr::BROADCAST;
assert_eq!(addr, Ipv4Addr::new(255, 255, 255, 255));
1.0.0 (const: 1.32.0) ยท Sourcepub const fn new(a: u8, b: u8, c: u8, d: u8) -> Ipv4Addr
pub const fn new(a: u8, b: u8, c: u8, d: u8) -> Ipv4Addr
Creates a new IPv4 address from four eight-bit octets.
The result will represent the IP address a
.b
.c
.d
.
ยงExamples
use std::net::Ipv4Addr;
let addr = Ipv4Addr::new(127, 0, 0, 1);
1.80.0 (const: 1.80.0) ยท Sourcepub const fn to_bits(self) -> u32
pub const fn to_bits(self) -> u32
Converts an IPv4 address into a u32
representation using native byte order.
Although IPv4 addresses are big-endian, the u32
value will use the target platformโs
native byte order. That is, the u32
value is an integer representation of the IPv4
address and not an integer interpretation of the IPv4 addressโs big-endian bitstring. This
means that the u32
value masked with 0xffffff00
will set the last octet in the address
to 0, regardless of the target platformโs endianness.
ยงExamples
use std::net::Ipv4Addr;
let addr = Ipv4Addr::new(0x12, 0x34, 0x56, 0x78);
assert_eq!(0x12345678, addr.to_bits());
use std::net::Ipv4Addr;
let addr = Ipv4Addr::new(0x12, 0x34, 0x56, 0x78);
let addr_bits = addr.to_bits() & 0xffffff00;
assert_eq!(Ipv4Addr::new(0x12, 0x34, 0x56, 0x00), Ipv4Addr::from_bits(addr_bits));
1.80.0 (const: 1.80.0) ยท Sourcepub const fn from_bits(bits: u32) -> Ipv4Addr
pub const fn from_bits(bits: u32) -> Ipv4Addr
Converts a native byte order u32
into an IPv4 address.
See Ipv4Addr::to_bits
for an explanation on endianness.
ยงExamples
use std::net::Ipv4Addr;
let addr = Ipv4Addr::from_bits(0x12345678);
assert_eq!(Ipv4Addr::new(0x12, 0x34, 0x56, 0x78), addr);
1.0.0 (const: 1.50.0) ยท Sourcepub const fn octets(&self) -> [u8; 4]
pub const fn octets(&self) -> [u8; 4]
Returns the four eight-bit integers that make up this address.
ยงExamples
use std::net::Ipv4Addr;
let addr = Ipv4Addr::new(127, 0, 0, 1);
assert_eq!(addr.octets(), [127, 0, 0, 1]);
Sourcepub const fn from_octets(octets: [u8; 4]) -> Ipv4Addr
๐ฌThis is a nightly-only experimental API. (ip_from
)
pub const fn from_octets(octets: [u8; 4]) -> Ipv4Addr
ip_from
)Creates an Ipv4Addr
from a four element byte array.
ยงExamples
#![feature(ip_from)]
use std::net::Ipv4Addr;
let addr = Ipv4Addr::from_octets([13u8, 12u8, 11u8, 10u8]);
assert_eq!(Ipv4Addr::new(13, 12, 11, 10), addr);
Sourcepub const fn as_octets(&self) -> &[u8; 4]
๐ฌThis is a nightly-only experimental API. (ip_as_octets
)
pub const fn as_octets(&self) -> &[u8; 4]
ip_as_octets
)Returns the four eight-bit integers that make up this address as a slice.
ยงExamples
#![feature(ip_as_octets)]
use std::net::Ipv4Addr;
let addr = Ipv4Addr::new(127, 0, 0, 1);
assert_eq!(addr.as_octets(), &[127, 0, 0, 1]);
1.12.0 (const: 1.32.0) ยท Sourcepub const fn is_unspecified(&self) -> bool
pub const fn is_unspecified(&self) -> bool
Returns true
for the special โunspecifiedโ address (0.0.0.0
).
This property is defined in UNIX Network Programming, Second Edition, W. Richard Stevens, p. 891; see also ip7.
ยงExamples
use std::net::Ipv4Addr;
assert_eq!(Ipv4Addr::new(0, 0, 0, 0).is_unspecified(), true);
assert_eq!(Ipv4Addr::new(45, 22, 13, 197).is_unspecified(), false);
1.7.0 (const: 1.50.0) ยท Sourcepub const fn is_loopback(&self) -> bool
pub const fn is_loopback(&self) -> bool
Returns true
if this is a loopback address (127.0.0.0/8
).
This property is defined by IETF RFC 1122.
ยงExamples
use std::net::Ipv4Addr;
assert_eq!(Ipv4Addr::new(127, 0, 0, 1).is_loopback(), true);
assert_eq!(Ipv4Addr::new(45, 22, 13, 197).is_loopback(), false);
1.7.0 (const: 1.50.0) ยท Sourcepub const fn is_private(&self) -> bool
pub const fn is_private(&self) -> bool
Returns true
if this is a private address.
The private address ranges are defined in IETF RFC 1918 and include:
10.0.0.0/8
172.16.0.0/12
192.168.0.0/16
ยงExamples
use std::net::Ipv4Addr;
assert_eq!(Ipv4Addr::new(10, 0, 0, 1).is_private(), true);
assert_eq!(Ipv4Addr::new(10, 10, 10, 10).is_private(), true);
assert_eq!(Ipv4Addr::new(172, 16, 10, 10).is_private(), true);
assert_eq!(Ipv4Addr::new(172, 29, 45, 14).is_private(), true);
assert_eq!(Ipv4Addr::new(172, 32, 0, 2).is_private(), false);
assert_eq!(Ipv4Addr::new(192, 168, 0, 2).is_private(), true);
assert_eq!(Ipv4Addr::new(192, 169, 0, 2).is_private(), false);
1.7.0 (const: 1.50.0) ยท Sourcepub const fn is_link_local(&self) -> bool
pub const fn is_link_local(&self) -> bool
Returns true
if the address is link-local (169.254.0.0/16
).
This property is defined by IETF RFC 3927.
ยงExamples
use std::net::Ipv4Addr;
assert_eq!(Ipv4Addr::new(169, 254, 0, 0).is_link_local(), true);
assert_eq!(Ipv4Addr::new(169, 254, 10, 65).is_link_local(), true);
assert_eq!(Ipv4Addr::new(16, 89, 10, 65).is_link_local(), false);
Sourcepub const fn is_global(&self) -> bool
๐ฌThis is a nightly-only experimental API. (ip
)
pub const fn is_global(&self) -> bool
ip
)Returns true
if the address appears to be globally reachable
as specified by the IANA IPv4 Special-Purpose Address Registry.
Whether or not an address is practically reachable will depend on your network configuration. Most IPv4 addresses are globally reachable, unless they are specifically defined as not globally reachable.
Non-exhaustive list of notable addresses that are not globally reachable:
- The unspecified address (
is_unspecified
) - Addresses reserved for private use (
is_private
) - Addresses in the shared address space (
is_shared
) - Loopback addresses (
is_loopback
) - Link-local addresses (
is_link_local
) - Addresses reserved for documentation (
is_documentation
) - Addresses reserved for benchmarking (
is_benchmarking
) - Reserved addresses (
is_reserved
) - The broadcast address (
is_broadcast
)
For the complete overview of which addresses are globally reachable, see the table at the IANA IPv4 Special-Purpose Address Registry.
ยงExamples
#![feature(ip)]
use std::net::Ipv4Addr;
// Most IPv4 addresses are globally reachable:
assert_eq!(Ipv4Addr::new(80, 9, 12, 3).is_global(), true);
// However some addresses have been assigned a special meaning
// that makes them not globally reachable. Some examples are:
// The unspecified address (`0.0.0.0`)
assert_eq!(Ipv4Addr::UNSPECIFIED.is_global(), false);
// Addresses reserved for private use (`10.0.0.0/8`, `172.16.0.0/12`, 192.168.0.0/16)
assert_eq!(Ipv4Addr::new(10, 254, 0, 0).is_global(), false);
assert_eq!(Ipv4Addr::new(192, 168, 10, 65).is_global(), false);
assert_eq!(Ipv4Addr::new(172, 16, 10, 65).is_global(), false);
// Addresses in the shared address space (`100.64.0.0/10`)
assert_eq!(Ipv4Addr::new(100, 100, 0, 0).is_global(), false);
// The loopback addresses (`127.0.0.0/8`)
assert_eq!(Ipv4Addr::LOCALHOST.is_global(), false);
// Link-local addresses (`169.254.0.0/16`)
assert_eq!(Ipv4Addr::new(169, 254, 45, 1).is_global(), false);
// Addresses reserved for documentation (`192.0.2.0/24`, `198.51.100.0/24`, `203.0.113.0/24`)
assert_eq!(Ipv4Addr::new(192, 0, 2, 255).is_global(), false);
assert_eq!(Ipv4Addr::new(198, 51, 100, 65).is_global(), false);
assert_eq!(Ipv4Addr::new(203, 0, 113, 6).is_global(), false);
// Addresses reserved for benchmarking (`198.18.0.0/15`)
assert_eq!(Ipv4Addr::new(198, 18, 0, 0).is_global(), false);
// Reserved addresses (`240.0.0.0/4`)
assert_eq!(Ipv4Addr::new(250, 10, 20, 30).is_global(), false);
// The broadcast address (`255.255.255.255`)
assert_eq!(Ipv4Addr::BROADCAST.is_global(), false);
// For a complete overview see the IANA IPv4 Special-Purpose Address Registry.
๐ฌThis is a nightly-only experimental API. (ip
)
ip
)Returns true
if this address is part of the Shared Address Space defined in
IETF RFC 6598 (100.64.0.0/10
).
ยงExamples
#![feature(ip)]
use std::net::Ipv4Addr;
assert_eq!(Ipv4Addr::new(100, 64, 0, 0).is_shared(), true);
assert_eq!(Ipv4Addr::new(100, 127, 255, 255).is_shared(), true);
assert_eq!(Ipv4Addr::new(100, 128, 0, 0).is_shared(), false);
Sourcepub const fn is_benchmarking(&self) -> bool
๐ฌThis is a nightly-only experimental API. (ip
)
pub const fn is_benchmarking(&self) -> bool
ip
)Returns true
if this address part of the 198.18.0.0/15
range, which is reserved for
network devices benchmarking.
This range is defined in IETF RFC 2544 as 192.18.0.0
through
198.19.255.255
but errata 423 corrects it to 198.18.0.0/15
.
ยงExamples
#![feature(ip)]
use std::net::Ipv4Addr;
assert_eq!(Ipv4Addr::new(198, 17, 255, 255).is_benchmarking(), false);
assert_eq!(Ipv4Addr::new(198, 18, 0, 0).is_benchmarking(), true);
assert_eq!(Ipv4Addr::new(198, 19, 255, 255).is_benchmarking(), true);
assert_eq!(Ipv4Addr::new(198, 20, 0, 0).is_benchmarking(), false);
Sourcepub const fn is_reserved(&self) -> bool
๐ฌThis is a nightly-only experimental API. (ip
)
pub const fn is_reserved(&self) -> bool
ip
)Returns true
if this address is reserved by IANA for future use.
IETF RFC 1112 defines the block of reserved addresses as 240.0.0.0/4
.
This range normally includes the broadcast address 255.255.255.255
, but
this implementation explicitly excludes it, since it is obviously not
reserved for future use.
ยงWarning
As IANA assigns new addresses, this method will be updated. This may result in non-reserved addresses being treated as reserved in code that relies on an outdated version of this method.
ยงExamples
#![feature(ip)]
use std::net::Ipv4Addr;
assert_eq!(Ipv4Addr::new(240, 0, 0, 0).is_reserved(), true);
assert_eq!(Ipv4Addr::new(255, 255, 255, 254).is_reserved(), true);
assert_eq!(Ipv4Addr::new(239, 255, 255, 255).is_reserved(), false);
// The broadcast address is not considered as reserved for future use by this implementation
assert_eq!(Ipv4Addr::new(255, 255, 255, 255).is_reserved(), false);
1.7.0 (const: 1.50.0) ยท Sourcepub const fn is_multicast(&self) -> bool
pub const fn is_multicast(&self) -> bool
Returns true
if this is a multicast address (224.0.0.0/4
).
Multicast addresses have a most significant octet between 224
and 239
,
and is defined by IETF RFC 5771.
ยงExamples
use std::net::Ipv4Addr;
assert_eq!(Ipv4Addr::new(224, 254, 0, 0).is_multicast(), true);
assert_eq!(Ipv4Addr::new(236, 168, 10, 65).is_multicast(), true);
assert_eq!(Ipv4Addr::new(172, 16, 10, 65).is_multicast(), false);
1.7.0 (const: 1.50.0) ยท Sourcepub const fn is_broadcast(&self) -> bool
pub const fn is_broadcast(&self) -> bool
Returns true
if this is a broadcast address (255.255.255.255
).
A broadcast address has all octets set to 255
as defined in IETF RFC 919.
ยงExamples
use std::net::Ipv4Addr;
assert_eq!(Ipv4Addr::new(255, 255, 255, 255).is_broadcast(), true);
assert_eq!(Ipv4Addr::new(236, 168, 10, 65).is_broadcast(), false);
1.7.0 (const: 1.50.0) ยท Sourcepub const fn is_documentation(&self) -> bool
pub const fn is_documentation(&self) -> bool
Returns true
if this address is in a range designated for documentation.
This is defined in IETF RFC 5737:
192.0.2.0/24
(TEST-NET-1)198.51.100.0/24
(TEST-NET-2)203.0.113.0/24
(TEST-NET-3)
ยงExamples
use std::net::Ipv4Addr;
assert_eq!(Ipv4Addr::new(192, 0, 2, 255).is_documentation(), true);
assert_eq!(Ipv4Addr::new(198, 51, 100, 65).is_documentation(), true);
assert_eq!(Ipv4Addr::new(203, 0, 113, 6).is_documentation(), true);
assert_eq!(Ipv4Addr::new(193, 34, 17, 19).is_documentation(), false);
1.0.0 (const: 1.50.0) ยท Sourcepub const fn to_ipv6_compatible(&self) -> Ipv6Addr
pub const fn to_ipv6_compatible(&self) -> Ipv6Addr
Converts this address to an IPv4-compatible IPv6
address.
a.b.c.d
becomes ::a.b.c.d
Note that IPv4-compatible addresses have been officially deprecated.
If you donโt explicitly need an IPv4-compatible address for legacy reasons, consider using to_ipv6_mapped
instead.
ยงExamples
use std::net::{Ipv4Addr, Ipv6Addr};
assert_eq!(
Ipv4Addr::new(192, 0, 2, 255).to_ipv6_compatible(),
Ipv6Addr::new(0, 0, 0, 0, 0, 0, 0xc000, 0x2ff)
);
1.0.0 (const: 1.50.0) ยท Sourcepub const fn to_ipv6_mapped(&self) -> Ipv6Addr
pub const fn to_ipv6_mapped(&self) -> Ipv6Addr
Converts this address to an IPv4-mapped IPv6
address.
a.b.c.d
becomes ::ffff:a.b.c.d
ยงExamples
use std::net::{Ipv4Addr, Ipv6Addr};
assert_eq!(Ipv4Addr::new(192, 0, 2, 255).to_ipv6_mapped(),
Ipv6Addr::new(0, 0, 0, 0, 0, 0xffff, 0xc000, 0x2ff));
Sourceยงimpl Ipv4Addr
impl Ipv4Addr
Sourcepub fn parse_ascii(b: &[u8]) -> Result<Ipv4Addr, AddrParseError>
๐ฌThis is a nightly-only experimental API. (addr_parse_ascii
)
pub fn parse_ascii(b: &[u8]) -> Result<Ipv4Addr, AddrParseError>
addr_parse_ascii
)Parse an IPv4 address from a slice of bytes.
#![feature(addr_parse_ascii)]
use std::net::Ipv4Addr;
let localhost = Ipv4Addr::new(127, 0, 0, 1);
assert_eq!(Ipv4Addr::parse_ascii(b"127.0.0.1"), Ok(localhost));
Trait Implementationsยง
ยงimpl<'a> AddAnyAttr for Ipv4Addr
impl<'a> AddAnyAttr for Ipv4Addr
ยงfn add_any_attr<NewAttr>(
self,
_attr: NewAttr,
) -> <Ipv4Addr as AddAnyAttr>::Output<NewAttr>where
NewAttr: Attribute,
fn add_any_attr<NewAttr>(
self,
_attr: NewAttr,
) -> <Ipv4Addr as AddAnyAttr>::Output<NewAttr>where
NewAttr: Attribute,
ยงimpl Archive for Ipv4Addr
impl Archive for Ipv4Addr
ยงimpl AttributeValue for Ipv4Addr
impl AttributeValue for Ipv4Addr
ยงtype AsyncOutput = Ipv4Addr
type AsyncOutput = Ipv4Addr
ยงtype State = (Element, Ipv4Addr)
type State = (Element, Ipv4Addr)
ยงtype Cloneable = Ipv4Addr
type Cloneable = Ipv4Addr
FnMut()
continues mutating the same
closure), but making a String
cloneable does not necessarily need to make it an
Arc<str>
, as two different clones of a String
will still have the same value.ยงtype CloneableOwned = Ipv4Addr
type CloneableOwned = Ipv4Addr
'static
. This is used for spreading across types when the
spreadable attribute needs to be owned. In some cases (&'a str
to Arc<str>
, etc.) the owned
cloneable type has worse performance than the cloneable type, so they are separate.ยงfn to_template(_key: &str, _buf: &mut String)
fn to_template(_key: &str, _buf: &mut String)
<template>
.ยงfn hydrate<const FROM_SERVER: bool>(
self,
key: &str,
el: &Element,
) -> <Ipv4Addr as AttributeValue>::State
fn hydrate<const FROM_SERVER: bool>( self, key: &str, el: &Element, ) -> <Ipv4Addr as AttributeValue>::State
<template>
.ยงfn build(self, el: &Element, key: &str) -> <Ipv4Addr as AttributeValue>::State
fn build(self, el: &Element, key: &str) -> <Ipv4Addr as AttributeValue>::State
ยงfn rebuild(self, key: &str, state: &mut <Ipv4Addr as AttributeValue>::State)
fn rebuild(self, key: &str, state: &mut <Ipv4Addr as AttributeValue>::State)
ยงfn into_cloneable(self) -> <Ipv4Addr as AttributeValue>::Cloneable
fn into_cloneable(self) -> <Ipv4Addr as AttributeValue>::Cloneable
ยงfn into_cloneable_owned(self) -> <Ipv4Addr as AttributeValue>::CloneableOwned
fn into_cloneable_owned(self) -> <Ipv4Addr as AttributeValue>::CloneableOwned
'static
.ยงfn dry_resolve(&mut self)
fn dry_resolve(&mut self)
1.75.0 ยท Sourceยงimpl BitAndAssign<&Ipv4Addr> for Ipv4Addr
impl BitAndAssign<&Ipv4Addr> for Ipv4Addr
Sourceยงfn bitand_assign(&mut self, rhs: &Ipv4Addr)
fn bitand_assign(&mut self, rhs: &Ipv4Addr)
&=
operation. Read more1.75.0 ยท Sourceยงimpl BitAndAssign for Ipv4Addr
impl BitAndAssign for Ipv4Addr
Sourceยงfn bitand_assign(&mut self, rhs: Ipv4Addr)
fn bitand_assign(&mut self, rhs: Ipv4Addr)
&=
operation. Read more1.75.0 ยท Sourceยงimpl BitOrAssign<&Ipv4Addr> for Ipv4Addr
impl BitOrAssign<&Ipv4Addr> for Ipv4Addr
Sourceยงfn bitor_assign(&mut self, rhs: &Ipv4Addr)
fn bitor_assign(&mut self, rhs: &Ipv4Addr)
|=
operation. Read more1.75.0 ยท Sourceยงimpl BitOrAssign for Ipv4Addr
impl BitOrAssign for Ipv4Addr
Sourceยงfn bitor_assign(&mut self, rhs: Ipv4Addr)
fn bitor_assign(&mut self, rhs: Ipv4Addr)
|=
operation. Read moreSourceยงimpl<'de, __Context> BorrowDecode<'de, __Context> for Ipv4Addr
impl<'de, __Context> BorrowDecode<'de, __Context> for Ipv4Addr
Sourceยงfn borrow_decode<D>(decoder: &mut D) -> Result<Ipv4Addr, DecodeError>where
D: BorrowDecoder<'de, Context = __Context>,
fn borrow_decode<D>(decoder: &mut D) -> Result<Ipv4Addr, DecodeError>where
D: BorrowDecoder<'de, Context = __Context>,
Sourceยงimpl<'de> Deserialize<'de> for Ipv4Addr
impl<'de> Deserialize<'de> for Ipv4Addr
Sourceยงfn deserialize<D>(
deserializer: D,
) -> Result<Ipv4Addr, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D,
) -> Result<Ipv4Addr, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
1.0.0 ยท Sourceยงimpl Ord for Ipv4Addr
impl Ord for Ipv4Addr
1.21.0 ยท Sourceยงfn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
ยงimpl PartialOrd<ArchivedIpv4Addr> for Ipv4Addr
impl PartialOrd<ArchivedIpv4Addr> for Ipv4Addr
1.16.0 ยท Sourceยงimpl PartialOrd<IpAddr> for Ipv4Addr
impl PartialOrd<IpAddr> for Ipv4Addr
ยงimpl PartialOrd<Ipv4Addr> for ArchivedIpv4Addr
impl PartialOrd<Ipv4Addr> for ArchivedIpv4Addr
1.16.0 ยท Sourceยงimpl PartialOrd<Ipv4Addr> for IpAddr
impl PartialOrd<Ipv4Addr> for IpAddr
1.0.0 ยท Sourceยงimpl PartialOrd for Ipv4Addr
impl PartialOrd for Ipv4Addr
ยงimpl PatchField for Ipv4Addr
impl PatchField for Ipv4Addr
ยงfn patch_field(
&mut self,
new: Ipv4Addr,
path: &StorePath,
notify: &mut dyn FnMut(&StorePath),
)
fn patch_field( &mut self, new: Ipv4Addr, path: &StorePath, notify: &mut dyn FnMut(&StorePath), )
ยงimpl Render for Ipv4Addr
impl Render for Ipv4Addr
ยงimpl RenderHtml for Ipv4Addr
impl RenderHtml for Ipv4Addr
ยงconst MIN_LENGTH: usize = 0usize
const MIN_LENGTH: usize = 0usize
ยงtype AsyncOutput = Ipv4Addr
type AsyncOutput = Ipv4Addr
ยงfn dry_resolve(&mut self)
fn dry_resolve(&mut self)
ยงasync fn resolve(self) -> <Ipv4Addr as RenderHtml>::AsyncOutput
async fn resolve(self) -> <Ipv4Addr as RenderHtml>::AsyncOutput
ยงfn to_html_with_buf(
self,
buf: &mut String,
position: &mut Position,
_escape: bool,
_mark_branches: bool,
_extra_attrs: Vec<AnyAttribute>,
)
fn to_html_with_buf( self, buf: &mut String, position: &mut Position, _escape: bool, _mark_branches: bool, _extra_attrs: Vec<AnyAttribute>, )
ยงfn hydrate<const FROM_SERVER: bool>(
self,
cursor: &Cursor,
position: &PositionState,
) -> <Ipv4Addr as Render>::State
fn hydrate<const FROM_SERVER: bool>( self, cursor: &Cursor, position: &PositionState, ) -> <Ipv4Addr as Render>::State
ยงfn into_owned(self) -> <Ipv4Addr as RenderHtml>::Owned
fn into_owned(self) -> <Ipv4Addr as RenderHtml>::Owned
'static
.ยงconst EXISTS: bool = true
const EXISTS: bool = true
ยงfn to_html_branching(self) -> Stringwhere
Self: Sized,
fn to_html_branching(self) -> Stringwhere
Self: Sized,
ยงfn to_html_stream_in_order(self) -> StreamBuilderwhere
Self: Sized,
fn to_html_stream_in_order(self) -> StreamBuilderwhere
Self: Sized,
ยงfn to_html_stream_in_order_branching(self) -> StreamBuilderwhere
Self: Sized,
fn to_html_stream_in_order_branching(self) -> StreamBuilderwhere
Self: Sized,
ยงfn to_html_stream_out_of_order(self) -> StreamBuilderwhere
Self: Sized,
fn to_html_stream_out_of_order(self) -> StreamBuilderwhere
Self: Sized,
ยงfn to_html_stream_out_of_order_branching(self) -> StreamBuilderwhere
Self: Sized,
fn to_html_stream_out_of_order_branching(self) -> StreamBuilderwhere
Self: Sized,
ยงfn to_html_async_with_buf<const OUT_OF_ORDER: bool>(
self,
buf: &mut StreamBuilder,
position: &mut Position,
escape: bool,
mark_branches: bool,
extra_attrs: Vec<AnyAttribute>,
)where
Self: Sized,
fn to_html_async_with_buf<const OUT_OF_ORDER: bool>(
self,
buf: &mut StreamBuilder,
position: &mut Position,
escape: bool,
mark_branches: bool,
extra_attrs: Vec<AnyAttribute>,
)where
Self: Sized,
ยงfn hydrate_async(
self,
cursor: &Cursor,
position: &PositionState,
) -> impl Future<Output = Self::State>
fn hydrate_async( self, cursor: &Cursor, position: &PositionState, ) -> impl Future<Output = Self::State>
ยงfn hydrate_from<const FROM_SERVER: bool>(self, el: &Element) -> Self::Statewhere
Self: Sized,
fn hydrate_from<const FROM_SERVER: bool>(self, el: &Element) -> Self::Statewhere
Self: Sized,
RenderHtml::hydrate
, beginning at the given element.ยงfn hydrate_from_position<const FROM_SERVER: bool>(
self,
el: &Element,
position: Position,
) -> Self::Statewhere
Self: Sized,
fn hydrate_from_position<const FROM_SERVER: bool>(
self,
el: &Element,
position: Position,
) -> Self::Statewhere
Self: Sized,
RenderHtml::hydrate
, beginning at the given element and position.Sourceยงimpl Serialize for Ipv4Addr
impl Serialize for Ipv4Addr
Sourceยงfn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
Sourceยงimpl Step for Ipv4Addr
impl Step for Ipv4Addr
Sourceยงfn steps_between(_: &Ipv4Addr, _: &Ipv4Addr) -> (usize, Option<usize>)
fn steps_between(_: &Ipv4Addr, _: &Ipv4Addr) -> (usize, Option<usize>)
step_trait
)start
to end
like Iterator::size_hint()
. Read moreSourceยงfn forward_checked(start: Ipv4Addr, count: usize) -> Option<Ipv4Addr>
fn forward_checked(start: Ipv4Addr, count: usize) -> Option<Ipv4Addr>
step_trait
)Sourceยงfn backward_checked(start: Ipv4Addr, count: usize) -> Option<Ipv4Addr>
fn backward_checked(start: Ipv4Addr, count: usize) -> Option<Ipv4Addr>
step_trait
)Sourceยงunsafe fn forward_unchecked(start: Ipv4Addr, count: usize) -> Ipv4Addr
unsafe fn forward_unchecked(start: Ipv4Addr, count: usize) -> Ipv4Addr
step_trait
)Sourceยงunsafe fn backward_unchecked(start: Ipv4Addr, count: usize) -> Ipv4Addr
unsafe fn backward_unchecked(start: Ipv4Addr, count: usize) -> Ipv4Addr
step_trait
)ยงimpl<'a> ToTemplate for Ipv4Addr
impl<'a> ToTemplate for Ipv4Addr
ยงfn to_template(
buf: &mut String,
_class: &mut String,
_style: &mut String,
_inner_html: &mut String,
position: &mut Position,
)
fn to_template( buf: &mut String, _class: &mut String, _style: &mut String, _inner_html: &mut String, position: &mut Position, )
<template>
that corresponds
to a view of a particular type.impl Copy for Ipv4Addr
impl Eq for Ipv4Addr
impl StructuralPartialEq for Ipv4Addr
impl TrustedStep for Ipv4Addr
Auto Trait Implementationsยง
impl Freeze for Ipv4Addr
impl RefUnwindSafe for Ipv4Addr
impl Send for Ipv4Addr
impl Sync for Ipv4Addr
impl Unpin for Ipv4Addr
impl UnwindSafe for Ipv4Addr
Blanket Implementationsยง
Sourceยงimpl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for Swhere
T: Real + Zero + Arithmetics + Clone,
Swp: WhitePoint<T>,
Dwp: WhitePoint<T>,
D: AdaptFrom<S, Swp, Dwp, T>,
impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for Swhere
T: Real + Zero + Arithmetics + Clone,
Swp: WhitePoint<T>,
Dwp: WhitePoint<T>,
D: AdaptFrom<S, Swp, Dwp, T>,
Sourceยงfn adapt_into_using<M>(self, method: M) -> Dwhere
M: TransformMatrix<T>,
fn adapt_into_using<M>(self, method: M) -> Dwhere
M: TransformMatrix<T>,
Sourceยงfn adapt_into(self) -> D
fn adapt_into(self) -> D
ยงimpl<T> ArchivePointee for T
impl<T> ArchivePointee for T
ยงtype ArchivedMetadata = ()
type ArchivedMetadata = ()
ยงfn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
ยงimpl<T> ArchiveUnsized for Twhere
T: Archive,
impl<T> ArchiveUnsized for Twhere
T: Archive,
ยงtype Archived = <T as Archive>::Archived
type Archived = <T as Archive>::Archived
Archive
, it may be unsized. Read moreยงtype MetadataResolver = ()
type MetadataResolver = ()
ยงunsafe fn resolve_metadata(
&self,
_: usize,
_: <T as ArchiveUnsized>::MetadataResolver,
_: *mut <<T as ArchiveUnsized>::Archived as ArchivePointee>::ArchivedMetadata,
)
unsafe fn resolve_metadata( &self, _: usize, _: <T as ArchiveUnsized>::MetadataResolver, _: *mut <<T as ArchiveUnsized>::Archived as ArchivePointee>::ArchivedMetadata, )
Sourceยงimpl<T, C> ArraysFrom<C> for Twhere
C: IntoArrays<T>,
impl<T, C> ArraysFrom<C> for Twhere
C: IntoArrays<T>,
Sourceยงfn arrays_from(colors: C) -> T
fn arrays_from(colors: C) -> T
Sourceยงimpl<T, C> ArraysInto<C> for Twhere
C: FromArrays<T>,
impl<T, C> ArraysInto<C> for Twhere
C: FromArrays<T>,
Sourceยงfn arrays_into(self) -> C
fn arrays_into(self) -> C
ยงimpl<V, Key, Sig, T> BindAttribute<Key, Sig, T> for Vwhere
V: AddAnyAttr,
Key: AttributeKey,
Sig: IntoSplitSignal<Value = T>,
T: FromEventTarget + AttributeValue + PartialEq + Sync + 'static,
Signal<BoolOrT<T>>: IntoProperty,
<Sig as IntoSplitSignal>::Read: Get<Value = T> + Send + Sync + Clone + 'static,
<Sig as IntoSplitSignal>::Write: Send + Clone + 'static,
Element: GetValue<T>,
impl<V, Key, Sig, T> BindAttribute<Key, Sig, T> for Vwhere
V: AddAnyAttr,
Key: AttributeKey,
Sig: IntoSplitSignal<Value = T>,
T: FromEventTarget + AttributeValue + PartialEq + Sync + 'static,
Signal<BoolOrT<T>>: IntoProperty,
<Sig as IntoSplitSignal>::Read: Get<Value = T> + Send + Sync + Clone + 'static,
<Sig as IntoSplitSignal>::Write: Send + Clone + 'static,
Element: GetValue<T>,
ยงtype Output = <V as AddAnyAttr>::Output<Bind<Key, T, <Sig as IntoSplitSignal>::Read, <Sig as IntoSplitSignal>::Write>>
type Output = <V as AddAnyAttr>::Output<Bind<Key, T, <Sig as IntoSplitSignal>::Read, <Sig as IntoSplitSignal>::Write>>
ยงfn bind(
self,
key: Key,
signal: Sig,
) -> <V as BindAttribute<Key, Sig, T>>::Output
fn bind( self, key: Key, signal: Sig, ) -> <V as BindAttribute<Key, Sig, T>>::Output
Sourceยงimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Sourceยงfn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
ยงimpl<T> CallHasher for T
impl<T> CallHasher for T
Sourceยงimpl<WpParam, T, U> Cam16IntoUnclamped<WpParam, T> for Uwhere
T: FromCam16Unclamped<WpParam, U>,
impl<WpParam, T, U> Cam16IntoUnclamped<WpParam, T> for Uwhere
T: FromCam16Unclamped<WpParam, U>,
Sourceยงtype Scalar = <T as FromCam16Unclamped<WpParam, U>>::Scalar
type Scalar = <T as FromCam16Unclamped<WpParam, U>>::Scalar
parameters
when converting.Sourceยงfn cam16_into_unclamped(
self,
parameters: BakedParameters<WpParam, <U as Cam16IntoUnclamped<WpParam, T>>::Scalar>,
) -> T
fn cam16_into_unclamped( self, parameters: BakedParameters<WpParam, <U as Cam16IntoUnclamped<WpParam, T>>::Scalar>, ) -> T
self
into C
, using the provided parameters.Sourceยงimpl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
ยงimpl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Sourceยงimpl<T, C> ComponentsFrom<C> for Twhere
C: IntoComponents<T>,
impl<T, C> ComponentsFrom<C> for Twhere
C: IntoComponents<T>,
Sourceยงfn components_from(colors: C) -> T
fn components_from(colors: C) -> T
ยงimpl<T, K, V> CustomAttribute<K, V> for Twhere
T: AddAnyAttr,
K: CustomAttributeKey,
V: AttributeValue,
impl<T, K, V> CustomAttribute<K, V> for Twhere
T: AddAnyAttr,
K: CustomAttributeKey,
V: AttributeValue,
ยงimpl<F, W, T, D> Deserialize<With<T, W>, D> for F
impl<F, W, T, D> Deserialize<With<T, W>, D> for F
ยงfn deserialize(
&self,
deserializer: &mut D,
) -> Result<With<T, W>, <D as Fallible>::Error>
fn deserialize( &self, deserializer: &mut D, ) -> Result<With<T, W>, <D as Fallible>::Error>
ยงimpl<V, T, P, D> DirectiveAttribute<T, P, D> for Vwhere
V: AddAnyAttr,
D: IntoDirective<T, P>,
P: Clone + 'static,
T: 'static,
impl<V, T, P, D> DirectiveAttribute<T, P, D> for Vwhere
V: AddAnyAttr,
D: IntoDirective<T, P>,
P: Clone + 'static,
T: 'static,
ยงtype Output = <V as AddAnyAttr>::Output<Directive<T, D, P>>
type Output = <V as AddAnyAttr>::Output<Directive<T, D, P>>
ยงfn directive(
self,
handler: D,
param: P,
) -> <V as DirectiveAttribute<T, P, D>>::Output
fn directive( self, handler: D, param: P, ) -> <V as DirectiveAttribute<T, P, D>>::Output
ยงimpl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
ยงfn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
, which can then be
downcast
into Box<dyn ConcreteType>
where ConcreteType
implements Trait
.ยงfn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
, which can then be further
downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.ยงfn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
โs vtable from &Trait
โs.ยงfn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
โs vtable from &mut Trait
โs.ยงimpl<T> DowncastSend for T
impl<T> DowncastSend for T
ยงimpl<T> DowncastSync for T
impl<T> DowncastSync for T
ยงimpl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
ยงfn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
ยงimpl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
ยงfn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.Sourceยงimpl<T> FromAngle<T> for T
impl<T> FromAngle<T> for T
Sourceยงfn from_angle(angle: T) -> T
fn from_angle(angle: T) -> T
angle
.ยงimpl<T> FromFormData for Twhere
T: DeserializeOwned,
impl<T> FromFormData for Twhere
T: DeserializeOwned,
ยงfn from_event(ev: &Event) -> Result<T, FromFormDataError>
fn from_event(ev: &Event) -> Result<T, FromFormDataError>
submit
event.ยงfn from_form_data(form_data: &FormData) -> Result<T, Error>
fn from_form_data(form_data: &FormData) -> Result<T, Error>
Sourceยงimpl<T, U> FromStimulus<U> for Twhere
U: IntoStimulus<T>,
impl<T, U> FromStimulus<U> for Twhere
U: IntoStimulus<T>,
Sourceยงfn from_stimulus(other: U) -> T
fn from_stimulus(other: U) -> T
other
into Self
, while performing the appropriate scaling,
rounding and clamping.Sourceยงimpl<T> Hexable for Twhere
T: Serialize + for<'de> Deserialize<'de>,
impl<T> Hexable for Twhere
T: Serialize + for<'de> Deserialize<'de>,
ยงimpl<T> Instrument for T
impl<T> Instrument for T
ยงfn instrument(self, span: Span) -> Instrumented<Self> โ
fn instrument(self, span: Span) -> Instrumented<Self> โ
Sourceยงimpl<T, U> IntoAngle<U> for Twhere
U: FromAngle<T>,
impl<T, U> IntoAngle<U> for Twhere
U: FromAngle<T>,
Sourceยงfn into_angle(self) -> U
fn into_angle(self) -> U
T
.ยงimpl<T> IntoAny for Twhere
T: Send + RenderHtml,
impl<T> IntoAny for Twhere
T: Send + RenderHtml,
ยงimpl<T> IntoAttributeValue for Twhere
T: AttributeValue,
impl<T> IntoAttributeValue for Twhere
T: AttributeValue,
ยงfn into_attribute_value(self) -> <T as IntoAttributeValue>::Output
fn into_attribute_value(self) -> <T as IntoAttributeValue>::Output
Sourceยงimpl<WpParam, T, U> IntoCam16Unclamped<WpParam, T> for Uwhere
T: Cam16FromUnclamped<WpParam, U>,
impl<WpParam, T, U> IntoCam16Unclamped<WpParam, T> for Uwhere
T: Cam16FromUnclamped<WpParam, U>,
Sourceยงtype Scalar = <T as Cam16FromUnclamped<WpParam, U>>::Scalar
type Scalar = <T as Cam16FromUnclamped<WpParam, U>>::Scalar
parameters
when converting.Sourceยงfn into_cam16_unclamped(
self,
parameters: BakedParameters<WpParam, <U as IntoCam16Unclamped<WpParam, T>>::Scalar>,
) -> T
fn into_cam16_unclamped( self, parameters: BakedParameters<WpParam, <U as IntoCam16Unclamped<WpParam, T>>::Scalar>, ) -> T
self
into C
, using the provided parameters.Sourceยงimpl<T, U> IntoColor<U> for Twhere
U: FromColor<T>,
impl<T, U> IntoColor<U> for Twhere
U: FromColor<T>,
Sourceยงfn into_color(self) -> U
fn into_color(self) -> U
Sourceยงimpl<T, U> IntoColorUnclamped<U> for Twhere
U: FromColorUnclamped<T>,
impl<T, U> IntoColorUnclamped<U> for Twhere
U: FromColorUnclamped<T>,
Sourceยงfn into_color_unclamped(self) -> U
fn into_color_unclamped(self) -> U
Sourceยงimpl<T> IntoEither for T
impl<T> IntoEither for T
Sourceยงfn into_either(self, into_left: bool) -> Either<Self, Self> โ
fn into_either(self, into_left: bool) -> Either<Self, Self> โ
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSourceยงfn into_either_with<F>(self, into_left: F) -> Either<Self, Self> โ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> โ
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreยงimpl<T> IntoMaybeErased for Twhere
T: RenderHtml,
impl<T> IntoMaybeErased for Twhere
T: RenderHtml,
ยงfn into_maybe_erased(self) -> <T as IntoMaybeErased>::Output
fn into_maybe_erased(self) -> <T as IntoMaybeErased>::Output
ยงimpl<T> IntoParam for T
impl<T> IntoParam for T
ยงimpl<T> IntoRender for Twhere
T: Render,
impl<T> IntoRender for Twhere
T: Render,
ยงfn into_render(self) -> <T as IntoRender>::Output
fn into_render(self) -> <T as IntoRender>::Output
Sourceยงimpl<T> IntoStimulus<T> for T
impl<T> IntoStimulus<T> for T
Sourceยงfn into_stimulus(self) -> T
fn into_stimulus(self) -> T
self
into T
, while performing the appropriate scaling,
rounding and clamping.ยงimpl<T> Pointable for T
impl<T> Pointable for T
ยงimpl<T> Pointee for T
impl<T> Pointee for T
ยงimpl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
ยงimpl<T> SerializableKey for T
impl<T> SerializableKey for T
ยงimpl<T, S> SerializeUnsized<S> for Twhere
T: Serialize<S>,
S: Serializer + ?Sized,
impl<T, S> SerializeUnsized<S> for Twhere
T: Serialize<S>,
S: Serializer + ?Sized,
ยงfn serialize_unsized(
&self,
serializer: &mut S,
) -> Result<usize, <S as Fallible>::Error>
fn serialize_unsized( &self, serializer: &mut S, ) -> Result<usize, <S as Fallible>::Error>
ยงfn serialize_metadata(&self, _: &mut S) -> Result<(), <S as Fallible>::Error>
fn serialize_metadata(&self, _: &mut S) -> Result<(), <S as Fallible>::Error>
ยงimpl<T> StorageAccess<T> for T
impl<T> StorageAccess<T> for T
ยงfn as_borrowed(&self) -> &T
fn as_borrowed(&self) -> &T
ยงfn into_taken(self) -> T
fn into_taken(self) -> T
ยงimpl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
ยงfn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string
, but without panic on OOM.
Sourceยงimpl<T, C> TryComponentsInto<C> for Twhere
C: TryFromComponents<T>,
impl<T, C> TryComponentsInto<C> for Twhere
C: TryFromComponents<T>,
Sourceยงtype Error = <C as TryFromComponents<T>>::Error
type Error = <C as TryFromComponents<T>>::Error
try_into_colors
fails to cast.Sourceยงfn try_components_into(self) -> Result<C, <T as TryComponentsInto<C>>::Error>
fn try_components_into(self) -> Result<C, <T as TryComponentsInto<C>>::Error>
Sourceยงimpl<T, U> TryIntoColor<U> for Twhere
U: TryFromColor<T>,
impl<T, U> TryIntoColor<U> for Twhere
U: TryFromColor<T>,
Sourceยงfn try_into_color(self) -> Result<U, OutOfBounds<U>>
fn try_into_color(self) -> Result<U, OutOfBounds<U>>
OutOfBounds
error is returned which contains
the unclamped color. Read more