pub struct AtStrError {
pub spec: SmolStr,
pub source: String,
pub kind: StrParseKind,
}Expand description
Parsing Error for atproto string types which don’t have third-party specs (e.g. datetime, CIDs, language tags).
spec refers to the final url path segment on atproto.com/specs,
detailing the specification for the type
source is the source string, or part of it
kind is the type of parsing error: [StrParseKind]
Fields§
§spec: SmolStrAT Protocol spec name this error relates to
source: StringThe source string that failed to parse
kind: StrParseKindThe specific kind of parsing error
Implementations§
Source§impl AtStrError
impl AtStrError
Sourcepub fn new(spec: &'static str, source: String, kind: StrParseKind) -> Self
pub fn new(spec: &'static str, source: String, kind: StrParseKind) -> Self
Create a new AT string parsing error
Sourcepub fn wrap(spec: &'static str, source: String, error: AtStrError) -> Self
pub fn wrap(spec: &'static str, source: String, error: AtStrError) -> Self
Wrap an existing error with a new spec context
Sourcepub fn disallowed(spec: &'static str, source: &str, disallowed: &[&str]) -> Self
pub fn disallowed(spec: &'static str, source: &str, disallowed: &[&str]) -> Self
something on the provided disallowed list was found in the source string does a substring search for any of the offending strings to get the span
Sourcepub fn too_long(
spec: &'static str,
source: &str,
max: usize,
actual: usize,
) -> Self
pub fn too_long( spec: &'static str, source: &str, max: usize, actual: usize, ) -> Self
Create an error for a string that exceeds the maximum length
Sourcepub fn too_short(
spec: &'static str,
source: &str,
min: usize,
actual: usize,
) -> Self
pub fn too_short( spec: &'static str, source: &str, min: usize, actual: usize, ) -> Self
Create an error for a string below the minimum length
Sourcepub fn missing(spec: &'static str, source: &str, expected: &str) -> Self
pub fn missing(spec: &'static str, source: &str, expected: &str) -> Self
missing component, with what was expected to be found
Trait Implementations§
Source§impl Clone for AtStrError
impl Clone for AtStrError
Source§fn clone(&self) -> AtStrError
fn clone(&self) -> AtStrError
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 AtStrError
impl Debug for AtStrError
Source§impl Diagnostic for AtStrError
impl Diagnostic for AtStrError
Source§fn help(&self) -> Option<Box<dyn Display + '_>>
fn help(&self) -> Option<Box<dyn Display + '_>>
Diagnostic. Do you have any
advice for the poor soul who’s just run into this issue?Source§fn url(&self) -> Option<Box<dyn Display + '_>>
fn url(&self) -> Option<Box<dyn Display + '_>>
Diagnostic.Source§fn source_code(&self) -> Option<&dyn SourceCode>
fn source_code(&self) -> Option<&dyn SourceCode>
Diagnostic’s Diagnostic::labels to.Source§fn diagnostic_source<'a>(&'a self) -> Option<&'a dyn Diagnostic>
fn diagnostic_source<'a>(&'a self) -> Option<&'a dyn Diagnostic>
Source§fn code<'a>(&'a self) -> Option<Box<dyn Display + 'a>>
fn code<'a>(&'a self) -> Option<Box<dyn Display + 'a>>
Diagnostic. Ideally also globally unique, and documented
in the toplevel crate’s documentation for easy searching. Rust path
format (foo::bar::baz) is recommended, but more classic codes like
E0123 or enums will work just fine.Source§fn severity(&self) -> Option<Severity>
fn severity(&self) -> Option<Severity>
ReportHandlers to change the display format
of this diagnostic. Read moreSource§fn labels(&self) -> Option<Box<dyn Iterator<Item = LabeledSpan> + '_>>
fn labels(&self) -> Option<Box<dyn Iterator<Item = LabeledSpan> + '_>>
Diagnostic’s Diagnostic::source_codeDiagnostics.Source§impl Display for AtStrError
impl Display for AtStrError
impl Eq for AtStrError
Source§impl Error for AtStrError
impl Error for AtStrError
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 From<AtStrError> for UriParseError
impl From<AtStrError> for UriParseError
Source§fn from(source: AtStrError) -> Self
fn from(source: AtStrError) -> Self
Source§impl From<AtStrError> for UriError
impl From<AtStrError> for UriError
Source§fn from(source: AtStrError) -> Self
fn from(source: AtStrError) -> Self
Source§impl PartialEq for AtStrError
impl PartialEq for AtStrError
Source§fn eq(&self, other: &AtStrError) -> bool
fn eq(&self, other: &AtStrError) -> bool
self and other values to be equal, and is used by ==.impl StructuralPartialEq for AtStrError
Auto Trait Implementations§
impl Freeze for AtStrError
impl RefUnwindSafe for AtStrError
impl Send for AtStrError
impl Sync for AtStrError
impl Unpin for AtStrError
impl UnsafeUnpin for AtStrError
impl UnwindSafe for AtStrError
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<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> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
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.