Struct UserInfo
pub struct UserInfo { /* private fields */ }net only.Expand description
Raw RFC 3986 userinfo bytes. Cheap to clone.
§Logging safety
The Debug impl redacts the password portion (anything
after the first :) as "***", matching Basic’s logging behaviour.
This is the safe default for tracing spans and log lines, where a raw
Debug-print of a Uri would otherwise leak
credentials into observability sinks. The user portion is rendered raw;
pct-encoded bytes are not decoded for the Debug view.
Implementations§
§impl UserInfo
impl UserInfo
pub const fn from_static(s: &'static str) -> UserInfo
pub const fn from_static(s: &'static str) -> UserInfo
Construct from a compile-time string. Zero-allocation.
Panics at compile time if s contains a byte outside the
RFC 3986 §3.2.1 userinfo grammar (unreserved / pct-encoded / sub-delims / ":"). This matches the URI parser’s strict-mode
validation: byte sets stay single-sourced, and typed construction
can never produce a UserInfo that the parser would reject.
Naming: from_static matches the Uri::from_static /
Domain::from_static precedent across the rest of the crate.
pub fn view(&self) -> UserInfoRef<'_>
pub fn view(&self) -> UserInfoRef<'_>
Borrowed view. Named view (not as_ref) so it doesn’t shadow
the std AsRef trait — see the type-level docs.
pub fn split_user_password(&self) -> (&[u8], Option<&[u8]>)
pub fn split_user_password(&self) -> (&[u8], Option<&[u8]>)
Split on the first :. Returns (user_bytes, password_bytes)
where the password is None if no : is present.
Bytes are raw — not percent-decoded. Use
crate::uri::util::percent_encoding to decode if needed.
Trait Implementations§
§impl<'a> From<&'a UserInfo> for UserInfoRef<'a>
impl<'a> From<&'a UserInfo> for UserInfoRef<'a>
§fn from(u: &'a UserInfo) -> UserInfoRef<'a>
fn from(u: &'a UserInfo) -> UserInfoRef<'a>
§impl From<Basic> for UserInfo
impl From<Basic> for UserInfo
§Spec divergence
Basic only rejects raw \r / \n / NUL bytes in its validation,
while UserInfo’s own TryFrom enforces the full RFC 3986 §3.2.1
userinfo grammar (rejects raw @, space, gen-delims, malformed pct,
pct-decoded control bytes). So this From impl can produce a
UserInfo containing bytes that UserInfo::try_from would
reject — Basic::new("user@host", "pw")? round-tripped through
this conversion will emit user@host:pw and serialize into a URI
authority that the parser then refuses to re-read.
This is deliberate (the conversion is infallible by trait
signature), and the planned follow-up is to drop UserInfo in
favour of a relaxed Basic altogether (see the type-level docs
for the migration plan). For now, callers that need the round-trip
guarantee should validate through UserInfo::try_from first.
§impl Ord for UserInfo
impl Ord for UserInfo
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
§impl PartialOrd for UserInfo
impl PartialOrd for UserInfo
§impl TryFrom<&UserInfo> for Basic
impl TryFrom<&UserInfo> for Basic
§impl TryFrom<&str> for UserInfo
impl TryFrom<&str> for UserInfo
§fn try_from(s: &str) -> Result<UserInfo, <UserInfo as TryFrom<&str>>::Error>
fn try_from(s: &str) -> Result<UserInfo, <UserInfo as TryFrom<&str>>::Error>
Validate s against the RFC 3986 §3.2.1 userinfo grammar —
same byte set the URI parser uses in strict mode. Rejects:
- Control bytes anywhere.
- Raw
@(must be percent-encoded as%40). - Raw space, brackets, gen-delims, and other non-userinfo bytes.
- Malformed pct-escapes (
%Xtruncated,%XYnon-hex). - Pct-decoded control bytes (smuggling vector).
Without this guard, Uri::set_authority(authority_with_loose_userinfo)
could embed bytes the parser would otherwise reject — producing
URIs that round-trip into malformed wire form.
§impl TryFrom<UserInfo> for Basic
impl TryFrom<UserInfo> for Basic
impl Eq for UserInfo
impl StructuralPartialEq for UserInfo
Auto Trait Implementations§
impl !Freeze for UserInfo
impl RefUnwindSafe for UserInfo
impl Send for UserInfo
impl Sync for UserInfo
impl Unpin for UserInfo
impl UnsafeUnpin for UserInfo
impl UnwindSafe for UserInfo
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