Add OptionalPath extractor (#1889)

Co-authored-by: David Pedersen <[email protected]>
This commit is contained in:
Jonas Platte
2023-04-09 12:23:13 +00:00
committed by GitHub
co-authored by David Pedersen
parent 946d8c3253
commit 43b2d52403
6 changed files with 124 additions and 13 deletions
+7 -1
View File
@@ -266,7 +266,8 @@ impl std::error::Error for PathDeserializationError {}
/// The kinds of errors that can happen we deserializing into a [`Path`].
///
/// This type is obtained through [`FailedToDeserializePathParams::into_kind`] and is useful for building
/// This type is obtained through [`FailedToDeserializePathParams::kind`] or
/// [`FailedToDeserializePathParams::into_kind`] and is useful for building
/// more precise error messages.
#[derive(Debug, PartialEq, Eq)]
#[non_exhaustive]
@@ -380,6 +381,11 @@ impl fmt::Display for ErrorKind {
pub struct FailedToDeserializePathParams(PathDeserializationError);
impl FailedToDeserializePathParams {
/// Get a reference to the underlying error kind.
pub fn kind(&self) -> &ErrorKind {
&self.0.kind
}
/// Convert this error into the underlying error kind.
pub fn into_kind(self) -> ErrorKind {
self.0.kind