pub struct Route {
pub pattern: UrlPattern,
pub method: HttpMethod,
pub response: MockResponse,
pub times: Option<usize>,
pub match_count: usize,
}Expand description
A route definition for interception
Fields§
§pattern: UrlPatternURL pattern to match
method: HttpMethodHTTP method to match
response: MockResponseResponse to return
times: Option<usize>Number of times this route should be used (None = unlimited)
match_count: usizeNumber of times this route has been matched
Implementations§
Source§impl Route
impl Route
Sourcepub fn new(
pattern: UrlPattern,
method: HttpMethod,
response: MockResponse,
) -> Self
pub fn new( pattern: UrlPattern, method: HttpMethod, response: MockResponse, ) -> Self
Create a new route
Sourcepub fn matches(&self, url: &str, method: &HttpMethod) -> bool
pub fn matches(&self, url: &str, method: &HttpMethod) -> bool
Check if this route matches a request
Sourcepub fn record_match(&mut self)
pub fn record_match(&mut self)
Record a match
Sourcepub fn is_exhausted(&self) -> bool
pub fn is_exhausted(&self) -> bool
Check if route is exhausted
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Route
impl RefUnwindSafe for Route
impl Send for Route
impl Sync for Route
impl Unpin for Route
impl UnsafeUnpin for Route
impl UnwindSafe for Route
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