pub enum ParseLocationPatternError {
UnknownSymbol {
symbol: String,
expect: &'static [&'static str],
},
InvalidRegex {
pattern: Arc<str>,
source: Error,
},
UndefinedPrefixOrCommon {
prefix: &'static str,
},
}Expand description
位置模式解析错误
§示例
use dhttp_access::pattern::{LocationPattern, ParseLocationPatternError};
// 未知符号
let result: Result<LocationPattern, _> = "@ /invalid".parse();
assert!(matches!(result, Err(ParseLocationPatternError::UnknownSymbol { .. })));
// 无效的正则表达式
let result: Result<LocationPattern, _> = "~ [".parse();
assert!(matches!(result, Err(ParseLocationPatternError::InvalidRegex { .. })));
// 未定义的前缀或通用模式
let result: Result<LocationPattern, _> = "invalid".parse();
assert!(matches!(result, Err(ParseLocationPatternError::UndefinedPrefixOrCommon { .. })));Variants§
UnknownSymbol
未知的符号
§Examples
use dhttp_access::pattern::{LocationPattern, ParseLocationPatternError};
let result: Result<LocationPattern, _> = "@ /invalid".parse();
assert!(matches!(result, Err(ParseLocationPatternError::UnknownSymbol { .. })));
let result: Result<LocationPattern, _> = "! /bad".parse();
assert!(matches!(result, Err(ParseLocationPatternError::UnknownSymbol { .. })));InvalidRegex
无效的正则表达式
§Examples
use dhttp_access::pattern::{LocationPattern, ParseLocationPatternError};
let result: Result<LocationPattern, _> = "~ [invalid".parse();
assert!(matches!(result, Err(ParseLocationPatternError::InvalidRegex { .. })));
let result: Result<LocationPattern, _> = "~* (?P<bad".parse();
assert!(matches!(result, Err(ParseLocationPatternError::InvalidRegex { .. })));UndefinedPrefixOrCommon
未定义的前缀或通用模式
§Examples
use dhttp_access::pattern::{LocationPattern, ParseLocationPatternError};
let result: Result<LocationPattern, _> = "invalid".parse();
assert!(matches!(result, Err(ParseLocationPatternError::UndefinedPrefixOrCommon { .. })));
let result: Result<LocationPattern, _> = "not_starting_with_slash".parse();
assert!(matches!(result, Err(ParseLocationPatternError::UndefinedPrefixOrCommon { .. })));Trait Implementations§
Source§impl Clone for ParseLocationPatternError
impl Clone for ParseLocationPatternError
Source§fn clone(&self) -> ParseLocationPatternError
fn clone(&self) -> ParseLocationPatternError
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 ParseLocationPatternError
impl Debug for ParseLocationPatternError
Source§impl Display for ParseLocationPatternError
impl Display for ParseLocationPatternError
Source§impl Error for ParseLocationPatternError
impl Error for ParseLocationPatternError
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 ErrorCompat for ParseLocationPatternError
impl ErrorCompat for ParseLocationPatternError
Source§fn iter_chain(&self) -> ChainCompat<'_, '_>where
Self: AsErrorSource,
fn iter_chain(&self) -> ChainCompat<'_, '_>where
Self: AsErrorSource,
Returns an iterator for traversing the chain of errors,
starting with the current error
and continuing with recursive calls to
Error::source. Read moreAuto Trait Implementations§
impl Freeze for ParseLocationPatternError
impl RefUnwindSafe for ParseLocationPatternError
impl Send for ParseLocationPatternError
impl Sync for ParseLocationPatternError
impl Unpin for ParseLocationPatternError
impl UnsafeUnpin for ParseLocationPatternError
impl UnwindSafe for ParseLocationPatternError
Blanket Implementations§
Source§impl<T> AsErrorSource for Twhere
T: Error + 'static,
impl<T> AsErrorSource for Twhere
T: Error + 'static,
Source§fn as_error_source(&self) -> &(dyn Error + 'static)
fn as_error_source(&self) -> &(dyn Error + 'static)
For maximum effectiveness, this needs to be called as a method
to benefit from Rust’s automatic dereferencing of method
receivers.
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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