pub enum ParseError {
InvalidPath(String),
MissingParameter(String),
TypeConversion(String),
InvalidQuery(String),
UrlEncoding(String),
SegmentCountMismatch {
expected: usize,
actual: usize,
},
SegmentMismatch {
expected: String,
actual: String,
position: usize,
},
}Expand description
解析错误类型
表示在路由解析过程中可能出现的各种错误情况
Variants§
InvalidPath(String)
无效的路径格式
当路径不符合预期格式时返回此错误
MissingParameter(String)
缺少必需的参数
当路径中缺少必需的参数时返回此错误
TypeConversion(String)
类型转换失败
当无法将字符串参数转换为目标类型时返回此错误
InvalidQuery(String)
无效的查询参数
当查询参数格式不正确时返回此错误
UrlEncoding(String)
URL 编码/解码错误
当 URL 编码或解码失败时返回此错误
SegmentCountMismatch
路径段数量不匹配
当实际路径段数量与模式不匹配时返回此错误
SegmentMismatch
路径段内容不匹配
当路径段的字面量内容不匹配时返回此错误
Implementations§
Source§impl ParseError
错误构造辅助函数
impl ParseError
错误构造辅助函数
Sourcepub fn invalid_path<S: Into<String>>(msg: S) -> Self
pub fn invalid_path<S: Into<String>>(msg: S) -> Self
创建无效路径错误
Sourcepub fn missing_parameter<S: Into<String>>(param: S) -> Self
pub fn missing_parameter<S: Into<String>>(param: S) -> Self
创建缺少参数错误
Sourcepub fn type_conversion<S: Into<String>>(msg: S) -> Self
pub fn type_conversion<S: Into<String>>(msg: S) -> Self
创建类型转换错误
Sourcepub fn invalid_query<S: Into<String>>(msg: S) -> Self
pub fn invalid_query<S: Into<String>>(msg: S) -> Self
创建无效查询错误
Sourcepub fn url_encoding<S: Into<String>>(msg: S) -> Self
pub fn url_encoding<S: Into<String>>(msg: S) -> Self
创建 URL 编码错误
Sourcepub fn segment_count_mismatch(expected: usize, actual: usize) -> Self
pub fn segment_count_mismatch(expected: usize, actual: usize) -> Self
创建段数量不匹配错误
Sourcepub fn segment_mismatch<S: Into<String>>(
expected: S,
actual: S,
position: usize,
) -> Self
pub fn segment_mismatch<S: Into<String>>( expected: S, actual: S, position: usize, ) -> Self
创建段内容不匹配错误
Trait Implementations§
Source§impl Clone for ParseError
impl Clone for ParseError
Source§fn clone(&self) -> ParseError
fn clone(&self) -> ParseError
Returns a duplicate of the value. Read more
1.0.0 · 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 ParseError
impl Debug for ParseError
Source§impl Display for ParseError
impl Display for ParseError
Source§impl Error for ParseError
impl Error for ParseError
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 PartialEq for ParseError
impl PartialEq for ParseError
impl StructuralPartialEq for ParseError
Auto Trait Implementations§
impl Freeze for ParseError
impl RefUnwindSafe for ParseError
impl Send for ParseError
impl Sync for ParseError
impl Unpin for ParseError
impl UnwindSafe for ParseError
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