#[non_exhaustive]pub enum CompositeKeyParseError {
MissingSeparator {
separator: char,
},
InvalidFirst(KeyParseError),
InvalidSecond(KeyParseError),
}Expand description
Error type for composite key parsing failures.
Returned by CompositeKey::from_str when the input
string cannot be parsed as a valid CompositeKey.
§Variants
MissingSeparator— the separator character was not found.InvalidFirst— the first component failed validation.InvalidSecond— the second component failed validation.
§Examples
use domain_key::{CompositeKey, CompositeKeyParseError};
use domain_key::{Domain, KeyDomain};
#[derive(Debug)]
struct UserDomain;
impl Domain for UserDomain { const DOMAIN_NAME: &'static str = "user"; }
impl KeyDomain for UserDomain {}
#[derive(Debug)]
struct PostDomain;
impl Domain for PostDomain { const DOMAIN_NAME: &'static str = "post"; }
impl KeyDomain for PostDomain {}
let err = "no-separator-here"
.parse::<CompositeKey<UserDomain, PostDomain>>()
.unwrap_err();
assert!(matches!(err, CompositeKeyParseError::MissingSeparator { separator: ':' }));Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
MissingSeparator
The separator character was not found in the input string.
InvalidFirst(KeyParseError)
The first component of the composite key failed to parse.
InvalidSecond(KeyParseError)
The second component of the composite key failed to parse.
Trait Implementations§
Source§impl Clone for CompositeKeyParseError
impl Clone for CompositeKeyParseError
Source§fn clone(&self) -> CompositeKeyParseError
fn clone(&self) -> CompositeKeyParseError
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for CompositeKeyParseError
impl Debug for CompositeKeyParseError
Source§impl Display for CompositeKeyParseError
impl Display for CompositeKeyParseError
Source§impl Error for CompositeKeyParseError
impl Error for CompositeKeyParseError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0:
use the Display impl or to_string()
Source§impl IntoResponse for CompositeKeyParseError
impl IntoResponse for CompositeKeyParseError
Source§fn into_response(self) -> Response
fn into_response(self) -> Response
Create a response.
Source§impl PartialEq for CompositeKeyParseError
impl PartialEq for CompositeKeyParseError
Source§fn eq(&self, other: &CompositeKeyParseError) -> bool
fn eq(&self, other: &CompositeKeyParseError) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl ResponseError for CompositeKeyParseError
impl ResponseError for CompositeKeyParseError
Source§fn status_code(&self) -> StatusCode
fn status_code(&self) -> StatusCode
Returns appropriate status code for error. Read more
Source§fn error_response(&self) -> HttpResponse
fn error_response(&self) -> HttpResponse
Creates full response for error. Read more
impl Eq for CompositeKeyParseError
impl StructuralPartialEq for CompositeKeyParseError
Auto Trait Implementations§
impl Freeze for CompositeKeyParseError
impl RefUnwindSafe for CompositeKeyParseError
impl Send for CompositeKeyParseError
impl Sync for CompositeKeyParseError
impl Unpin for CompositeKeyParseError
impl UnsafeUnpin for CompositeKeyParseError
impl UnwindSafe for CompositeKeyParseError
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
Mutably borrows from an owned value. Read more
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§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
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, S> Handler<IntoResponseHandler, S> for T
impl<T, S> Handler<IntoResponseHandler, S> for T
Source§fn call(
self,
_req: Request<Body>,
_state: S,
) -> <T as Handler<IntoResponseHandler, S>>::Future
fn call( self, _req: Request<Body>, _state: S, ) -> <T as Handler<IntoResponseHandler, S>>::Future
Call the handler with the given request.
Source§fn layer<L>(self, layer: L) -> Layered<L, Self, T, S>where
L: Layer<HandlerService<Self, T, S>> + Clone,
<L as Layer<HandlerService<Self, T, S>>>::Service: Service<Request<Body>>,
fn layer<L>(self, layer: L) -> Layered<L, Self, T, S>where
L: Layer<HandlerService<Self, T, S>> + Clone,
<L as Layer<HandlerService<Self, T, S>>>::Service: Service<Request<Body>>,
Apply a
tower::Layer to the handler. Read moreSource§fn with_state(self, state: S) -> HandlerService<Self, T, S>
fn with_state(self, state: S) -> HandlerService<Self, T, S>
Convert the handler into a
Service by providing the stateSource§impl<H, T> HandlerWithoutStateExt<T> for H
impl<H, T> HandlerWithoutStateExt<T> for H
Source§fn into_service(self) -> HandlerService<H, T, ()>
fn into_service(self) -> HandlerService<H, T, ()>
Convert the handler into a
Service and no state.Source§fn into_make_service(self) -> IntoMakeService<HandlerService<H, T, ()>>
fn into_make_service(self) -> IntoMakeService<HandlerService<H, T, ()>>
Convert the handler into a
MakeService and no state. Read moreSource§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>
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