-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Extend path search struct to work as request builder.
- Loading branch information
1 parent
560de66
commit 987f1bc
Showing
22 changed files
with
417 additions
and
340 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
use super::EncodingError; | ||
use core::{error::Error, fmt::Display}; | ||
|
||
/// Errors that can occur when creating a [`Request`](`crate::Request`). | ||
#[derive(Debug, PartialEq, Eq)] | ||
pub enum RequestError { | ||
/// A [`EncodingError`] that occurred during the decoding. | ||
EncodingError(EncodingError), | ||
|
||
/// The path was not provided when building the [`Request`](`crate::Request`). | ||
/// | ||
/// # Examples | ||
/// | ||
/// ```rust | ||
/// use wayfind::errors::RequestError; | ||
/// | ||
/// let error = RequestError::MissingPath; | ||
/// | ||
/// let display = " | ||
/// missing path | ||
/// | ||
/// A path must be provided when building a Request | ||
/// "; | ||
/// | ||
/// assert_eq!(error.to_string(), display.trim()); | ||
/// ``` | ||
MissingPath, | ||
} | ||
|
||
impl Error for RequestError {} | ||
|
||
impl Display for RequestError { | ||
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { | ||
match self { | ||
Self::EncodingError(error) => error.fmt(f), | ||
Self::MissingPath => write!( | ||
f, | ||
r#"missing path | ||
A path must be provided when building a Request"# | ||
), | ||
} | ||
} | ||
} | ||
|
||
impl From<EncodingError> for RequestError { | ||
fn from(error: EncodingError) -> Self { | ||
Self::EncodingError(error) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.