Struct UninterpretedHost
pub struct UninterpretedHost { /* private fields */ }net only.Expand description
Reg-name / IP-literal host bytes preserved verbatim.
Wire-fidelity is the design contract: this type is
construction-free from the public API — only the URI parser
builds it, by preserving bytes off the wire. Two grammar shapes
land here, distinguished by is_bracketed:
- Non-bracketed
reg-name: bytes outside the strict DNS-label shape — pct-encoded segments (exa%6Dple.com), sub-delim characters (tag,with,commas), or raw non-ASCII UTF-8 (münchen.deunder graceful URI parsing / IRI). - Bracketed IPvFuture literal (
[vN.X]): brackets are URI syntax, not host content; they’re not stored, butDisplayre-adds them.
Callers either keep an UninterpretedHost as-is (forwarding,
logging) or convert into Domain, IpAddr,
Ipv4Addr, or Ipv6Addr
via the TryFrom impls — which apply pct-decoding and (for
Domain) UTS #46 IDN normalization on the way.
§Equality, hashing, ordering
All three apply RFC 3986 §6.2.2 syntactic equivalence:
- Bytes are ASCII-case-insensitive (§6.2.2.1), matching the rest of
the host stack (
Domain, theHostenum). - Pct-encoded triplets are decoded on the fly (§6.2.2.2), so
%44≡%64≡D≡d.exa%6Dple.com,EXA%6dple.COM, andexample.comall compare equal. - The bracketed flag is compared strictly: a bracketed
[v1.fe80::a]is never equal to an unbracketedv1.fe80::aregardless of byte content — distinct host shapes.
Equality is semantic (per RFC); wire bytes are preserved separately
and recoverable via as_bytes /
as_str.
Implementations§
§impl UninterpretedHost
impl UninterpretedHost
pub fn view(&self) -> UninterpretedHostRef<'_>
pub fn view(&self) -> UninterpretedHostRef<'_>
Borrow this host as an UninterpretedHostRef. The
inspection / conversion API lives on the Ref type; the owned
type’s accessors here just delegate, so there’s one
implementation to maintain. Named view (not as_ref) so it
doesn’t shadow the std AsRef trait.
pub fn as_str(&self) -> &str
pub fn as_str(&self) -> &str
The raw on-the-wire bytes — not pct-decoded. For bracketed literals, the surrounding brackets are not included.
pub fn is_bracketed(&self) -> bool
pub fn is_bracketed(&self) -> bool
true when this came from a bracketed IP-literal ([vN.X]).
Display adds the brackets back; equality
respects the flag.
pub fn as_unicode(&self) -> Cow<'_, str>
pub fn as_unicode(&self) -> Cow<'_, str>
Pct-decoded view. See UninterpretedHostRef::as_unicode for
the contract — this is a delegating wrapper.
Trait Implementations§
§impl Clone for UninterpretedHost
impl Clone for UninterpretedHost
§fn clone(&self) -> UninterpretedHost
fn clone(&self) -> UninterpretedHost
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more§impl Debug for UninterpretedHost
impl Debug for UninterpretedHost
§impl Display for UninterpretedHost
impl Display for UninterpretedHost
§impl<'a> From<&'a UninterpretedHost> for UninterpretedHostRef<'a>
impl<'a> From<&'a UninterpretedHost> for UninterpretedHostRef<'a>
§fn from(host: &'a UninterpretedHost) -> UninterpretedHostRef<'a>
fn from(host: &'a UninterpretedHost) -> UninterpretedHostRef<'a>
§impl Hash for UninterpretedHost
impl Hash for UninterpretedHost
§impl Ord for UninterpretedHost
impl Ord for UninterpretedHost
§fn cmp(&self, other: &UninterpretedHost) -> Ordering
fn cmp(&self, other: &UninterpretedHost) -> Ordering
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
§impl PartialEq for UninterpretedHost
impl PartialEq for UninterpretedHost
§fn eq(&self, other: &UninterpretedHost) -> bool
fn eq(&self, other: &UninterpretedHost) -> bool
self and other values to be equal, and is used by ==.§impl PartialOrd for UninterpretedHost
impl PartialOrd for UninterpretedHost
§impl TryFrom<&UninterpretedHost> for Domain
impl TryFrom<&UninterpretedHost> for Domain
§type Error = DomainParseError
type Error = DomainParseError
§fn try_from(
host: &UninterpretedHost,
) -> Result<Domain, <Domain as TryFrom<&UninterpretedHost>>::Error>
fn try_from( host: &UninterpretedHost, ) -> Result<Domain, <Domain as TryFrom<&UninterpretedHost>>::Error>
§impl TryFrom<&UninterpretedHost> for IpAddr
impl TryFrom<&UninterpretedHost> for IpAddr
§type Error = AddrParseError
type Error = AddrParseError
§fn try_from(
host: &UninterpretedHost,
) -> Result<IpAddr, <IpAddr as TryFrom<&UninterpretedHost>>::Error>
fn try_from( host: &UninterpretedHost, ) -> Result<IpAddr, <IpAddr as TryFrom<&UninterpretedHost>>::Error>
§impl TryFrom<&UninterpretedHost> for Ipv4Addr
impl TryFrom<&UninterpretedHost> for Ipv4Addr
§type Error = AddrParseError
type Error = AddrParseError
§fn try_from(
host: &UninterpretedHost,
) -> Result<Ipv4Addr, <Ipv4Addr as TryFrom<&UninterpretedHost>>::Error>
fn try_from( host: &UninterpretedHost, ) -> Result<Ipv4Addr, <Ipv4Addr as TryFrom<&UninterpretedHost>>::Error>
§impl TryFrom<&UninterpretedHost> for Ipv6Addr
impl TryFrom<&UninterpretedHost> for Ipv6Addr
§type Error = AddrParseError
type Error = AddrParseError
§fn try_from(
host: &UninterpretedHost,
) -> Result<Ipv6Addr, <Ipv6Addr as TryFrom<&UninterpretedHost>>::Error>
fn try_from( host: &UninterpretedHost, ) -> Result<Ipv6Addr, <Ipv6Addr as TryFrom<&UninterpretedHost>>::Error>
§impl TryFrom<UninterpretedHost> for Domain
impl TryFrom<UninterpretedHost> for Domain
§type Error = DomainParseError
type Error = DomainParseError
§fn try_from(
host: UninterpretedHost,
) -> Result<Domain, <Domain as TryFrom<UninterpretedHost>>::Error>
fn try_from( host: UninterpretedHost, ) -> Result<Domain, <Domain as TryFrom<UninterpretedHost>>::Error>
§impl TryFrom<UninterpretedHost> for IpAddr
impl TryFrom<UninterpretedHost> for IpAddr
§type Error = AddrParseError
type Error = AddrParseError
§fn try_from(
host: UninterpretedHost,
) -> Result<IpAddr, <IpAddr as TryFrom<UninterpretedHost>>::Error>
fn try_from( host: UninterpretedHost, ) -> Result<IpAddr, <IpAddr as TryFrom<UninterpretedHost>>::Error>
§impl TryFrom<UninterpretedHost> for Ipv4Addr
impl TryFrom<UninterpretedHost> for Ipv4Addr
§type Error = AddrParseError
type Error = AddrParseError
§fn try_from(
host: UninterpretedHost,
) -> Result<Ipv4Addr, <Ipv4Addr as TryFrom<UninterpretedHost>>::Error>
fn try_from( host: UninterpretedHost, ) -> Result<Ipv4Addr, <Ipv4Addr as TryFrom<UninterpretedHost>>::Error>
§impl TryFrom<UninterpretedHost> for Ipv6Addr
impl TryFrom<UninterpretedHost> for Ipv6Addr
§type Error = AddrParseError
type Error = AddrParseError
§fn try_from(
host: UninterpretedHost,
) -> Result<Ipv6Addr, <Ipv6Addr as TryFrom<UninterpretedHost>>::Error>
fn try_from( host: UninterpretedHost, ) -> Result<Ipv6Addr, <Ipv6Addr as TryFrom<UninterpretedHost>>::Error>
impl Eq for UninterpretedHost
Auto Trait Implementations§
impl !Freeze for UninterpretedHost
impl RefUnwindSafe for UninterpretedHost
impl Send for UninterpretedHost
impl Sync for UninterpretedHost
impl Unpin for UninterpretedHost
impl UnsafeUnpin for UninterpretedHost
impl UnwindSafe for UninterpretedHost
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
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
§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.§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
§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> ⓘ
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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a rama_grpc::Request§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>
Policy that returns Action::Follow only if self and other return
Action::Follow. Read more§impl<T, U> RamaTryFrom<T> for Uwhere
U: TryFrom<T>,
impl<T, U> RamaTryFrom<T> for Uwhere
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
fn rama_try_from(value: T) -> Result<U, <U as RamaTryFrom<T>>::Error>
§impl<T, U, CrateMarker> RamaTryInto<U, CrateMarker> for Twhere
U: RamaTryFrom<T, CrateMarker>,
impl<T, U, CrateMarker> RamaTryInto<U, CrateMarker> for Twhere
U: RamaTryFrom<T, CrateMarker>,
type Error = <U as RamaTryFrom<T, CrateMarker>>::Error
fn rama_try_into(self) -> Result<U, <U as RamaTryFrom<T, CrateMarker>>::Error>
§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.
§impl<V, F> ValueFormatter<&V> for F
impl<V, F> ValueFormatter<&V> for F
§fn format_value(writer: impl ValueWriter, value: &&V)
fn format_value(writer: impl ValueWriter, value: &&V)
value to writer§impl<V, F> ValueFormatter<Arc<V>> for F
impl<V, F> ValueFormatter<Arc<V>> for F
§fn format_value(writer: impl ValueWriter, value: &Arc<V>)
fn format_value(writer: impl ValueWriter, value: &Arc<V>)
value to writer§impl<V, F> ValueFormatter<Box<V>> for F
impl<V, F> ValueFormatter<Box<V>> for F
§fn format_value(writer: impl ValueWriter, value: &Box<V>)
fn format_value(writer: impl ValueWriter, value: &Box<V>)
value to writer§impl<V, F> ValueFormatter<Cow<'_, V>> for F
impl<V, F> ValueFormatter<Cow<'_, V>> for F
§fn format_value(writer: impl ValueWriter, value: &Cow<'_, V>)
fn format_value(writer: impl ValueWriter, value: &Cow<'_, V>)
value to writer§impl<V, F> ValueFormatter<Option<V>> for Fwhere
F: ValueFormatter<V> + ?Sized,
impl<V, F> ValueFormatter<Option<V>> for Fwhere
F: ValueFormatter<V> + ?Sized,
§fn format_value(writer: impl ValueWriter, value: &Option<V>)
fn format_value(writer: impl ValueWriter, value: &Option<V>)
value to writer