Struct ClientSubnet
pub struct ClientSubnet { /* private fields */ }
Expand description
RFC 7871, Client Subnet, Optional
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
0: | FAMILY |
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
2: | SOURCE PREFIX-LENGTH | SCOPE PREFIX-LENGTH |
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
4: | ADDRESS... /
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
o FAMILY, 2 octets, indicates the family of the address contained in
the option, using address family codes as assigned by IANA in
Address Family Numbers [Address_Family_Numbers].
o SOURCE PREFIX-LENGTH, an unsigned octet representing the leftmost
number of significant bits of ADDRESS to be used for the lookup.
In responses, it mirrors the same value as in the queries.
o SCOPE PREFIX-LENGTH, an unsigned octet representing the leftmost
number of significant bits of ADDRESS that the response covers.
In queries, it MUST be set to 0.
o ADDRESS, variable number of octets, contains either an IPv4 or
IPv6 address, depending on FAMILY, which MUST be truncated to the
number of bits indicated by the SOURCE PREFIX-LENGTH field,
padding with 0 bits to pad to the end of the last octet needed.
o A server receiving an ECS option that uses either too few or too
many ADDRESS octets, or that has non-zero ADDRESS bits set beyond
SOURCE PREFIX-LENGTH, SHOULD return FORMERR to reject the packet,
as a signal to the software developer making the request to fix
their implementation.
Implementations§
§impl ClientSubnet
impl ClientSubnet
pub fn new(address: IpAddr, source_prefix: u8, scope_prefix: u8) -> ClientSubnet
pub fn new(address: IpAddr, source_prefix: u8, scope_prefix: u8) -> ClientSubnet
Construct a new EcsOption with the address, source_prefix and scope_prefix.
pub fn source_prefix(&self) -> u8
pub fn source_prefix(&self) -> u8
returns the source prefix
pub fn set_source_prefix(&mut self, source_prefix: u8)
pub fn set_source_prefix(&mut self, source_prefix: u8)
returns the source prefix
pub fn scope_prefix(&self) -> u8
pub fn scope_prefix(&self) -> u8
returns the scope prefix
pub fn set_scope_prefix(&mut self, scope_prefix: u8)
pub fn set_scope_prefix(&mut self, scope_prefix: u8)
returns the scope prefix
Trait Implementations§
§impl<'a> BinDecodable<'a> for ClientSubnet
impl<'a> BinDecodable<'a> for ClientSubnet
§fn read(decoder: &mut BinDecoder<'a>) -> Result<ClientSubnet, ProtoError>
fn read(decoder: &mut BinDecoder<'a>) -> Result<ClientSubnet, ProtoError>
Read the type from the stream
§fn from_bytes(bytes: &'r [u8]) -> Result<Self, ProtoError>
fn from_bytes(bytes: &'r [u8]) -> Result<Self, ProtoError>
Returns the object in binary form
§impl BinEncodable for ClientSubnet
impl BinEncodable for ClientSubnet
§fn emit(&self, encoder: &mut BinEncoder<'_>) -> Result<(), ProtoError>
fn emit(&self, encoder: &mut BinEncoder<'_>) -> Result<(), ProtoError>
Write the type to the stream
§impl Clone for ClientSubnet
impl Clone for ClientSubnet
§fn clone(&self) -> ClientSubnet
fn clone(&self) -> ClientSubnet
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read more§impl Debug for ClientSubnet
impl Debug for ClientSubnet
§impl From<IpNet> for ClientSubnet
impl From<IpNet> for ClientSubnet
§fn from(net: IpNet) -> ClientSubnet
fn from(net: IpNet) -> ClientSubnet
Converts to this type from the input type.
§impl FromStr for ClientSubnet
impl FromStr for ClientSubnet
§type Err = AddrParseError
type Err = AddrParseError
The associated error which can be returned from parsing.
§fn from_str(s: &str) -> Result<ClientSubnet, <ClientSubnet as FromStr>::Err>
fn from_str(s: &str) -> Result<ClientSubnet, <ClientSubnet as FromStr>::Err>
Parses a string
s
to return a value of this type. Read more§impl Hash for ClientSubnet
impl Hash for ClientSubnet
§impl PartialEq for ClientSubnet
impl PartialEq for ClientSubnet
§impl PartialOrd for ClientSubnet
impl PartialOrd for ClientSubnet
§impl<'a> TryFrom<&'a [u8]> for ClientSubnet
impl<'a> TryFrom<&'a [u8]> for ClientSubnet
§type Error = ProtoError
type Error = ProtoError
The type returned in the event of a conversion error.
§fn try_from(
value: &'a [u8],
) -> Result<ClientSubnet, <ClientSubnet as TryFrom<&'a [u8]>>::Error>
fn try_from( value: &'a [u8], ) -> Result<ClientSubnet, <ClientSubnet as TryFrom<&'a [u8]>>::Error>
Performs the conversion.
§impl<'a> TryFrom<&'a ClientSubnet> for Vec<u8>
impl<'a> TryFrom<&'a ClientSubnet> for Vec<u8>
§type Error = ProtoError
type Error = ProtoError
The type returned in the event of a conversion error.
impl Copy for ClientSubnet
impl Eq for ClientSubnet
impl StructuralPartialEq for ClientSubnet
Auto Trait Implementations§
impl Freeze for ClientSubnet
impl RefUnwindSafe for ClientSubnet
impl Send for ClientSubnet
impl Sync for ClientSubnet
impl Unpin for ClientSubnet
impl UnwindSafe for ClientSubnet
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§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
Compare self to
key
and return true
if they are equal.§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
Checks if this value is equivalent to the given key. Read more
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
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> ⓘ
Converts
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> ⓘ
Converts
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> Pointable for T
impl<T> Pointable for T
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§fn and<P, B, E>(self, other: P) -> And<T, P>
fn and<P, B, E>(self, other: P) -> And<T, P>
Create a new
Policy
that returns Action::Follow
only if self
and other
return
Action::Follow
. Read more