#[non_exhaustive]pub enum StringNewtypeError {
Empty,
Nul,
Newline,
Control,
#[non_exhaustive] TooLong {
len: usize,
max: usize,
},
UnicodeTag,
}Expand description
Reasons a string value cannot be promoted into a validated string newtype
defined via the crate::string_newtype! macro.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Empty
The value is empty.
Nul
The value contains a NUL byte.
Newline
The value contains a carriage return or line feed.
Control
The value contains an ASCII control character other than tab.
#[non_exhaustive]TooLong
The UTF-8 value exceeds STRING_NEWTYPE_MAX_BYTES.
Fields
This variant is marked as non-exhaustive
UnicodeTag
The value contains a Unicode-tag codepoint (U+E0000..U+E007F). These are invisible to humans but readable by some downstream tooling, a known “ASCII smuggling” / log-injection vector. Rejected to keep the type-level “no header injection, ever” contract honest beyond the ASCII-control byte set.
§Scope
The Unicode-tag rejection (U+E0000..U+E007F) is scoped to the ASCII-smuggling family only. Other zero-width and visually-confusable codepoints (U+200B..U+200D zero-width spaces, U+2060 word-joiner, U+FEFF BOM, the U+FE00..U+FE0F variation selectors, U+E0100..U+E01EF supplementary variation selectors) are out of scope by design: legitimate text in many scripts (Korean, Hebrew, several CJK renderings) uses them and rejecting them would break valid identifier values. Callers that need a stricter character class should layer their own normalization or rejection on top.
Trait Implementations§
Source§impl Clone for StringNewtypeError
impl Clone for StringNewtypeError
Source§fn clone(&self) -> StringNewtypeError
fn clone(&self) -> StringNewtypeError
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for StringNewtypeError
impl Debug for StringNewtypeError
Source§impl Display for StringNewtypeError
impl Display for StringNewtypeError
impl Eq for StringNewtypeError
Source§impl Error for StringNewtypeError
impl Error for StringNewtypeError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
Source§impl PartialEq for StringNewtypeError
impl PartialEq for StringNewtypeError
impl StructuralPartialEq for StringNewtypeError
Auto Trait Implementations§
impl Freeze for StringNewtypeError
impl RefUnwindSafe for StringNewtypeError
impl Send for StringNewtypeError
impl Sync for StringNewtypeError
impl Unpin for StringNewtypeError
impl UnsafeUnpin for StringNewtypeError
impl UnwindSafe for StringNewtypeError
Blanket Implementations§
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,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§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 moreimpl<T> MaybeSend for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> RuntimeBound for T
Source§impl<T> ToEcoString for T
impl<T> ToEcoString for T
Source§fn to_eco_string(&self) -> EcoString
fn to_eco_string(&self) -> EcoString
EcoString.Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.