pub struct ForUrl<'a> { /* private fields */ }
Implementations§
Source§impl<'a> ForUrl<'a>
impl<'a> ForUrl<'a>
Sourcepub fn fail(self, error: ResolveError)
pub fn fail(self, error: ResolveError)
Fail resolve requests for the given URL with the given error status.
Sourcepub fn resolve(self, pkg: &TestPackage)
pub fn resolve(self, pkg: &TestPackage)
Succeed resolve requests for the given URL by serving the given package.
Sourcepub fn block_once(self) -> ResolveHandler
pub fn block_once(self) -> ResolveHandler
Blocks requests for the given URL once, allowing the returned handler control the response. Panics on further requests for that URL.
Sourcepub fn respond_serially(self, responses: Vec<Result<TestPackage, ResolveError>>)
pub fn respond_serially(self, responses: Vec<Result<TestPackage, ResolveError>>)
Respond to resolve requests serially with a list of pre-defined immediate responses. This is useful if the caller wants to make several resolve calls for the same url and have each resolve call return something different.
This API is different from the other ForUrl APIs because the mock resolver will use each response exactly once. In the other APIs, the resolver will always return the given response for a url regardless of how many times resolve() is called.
Auto Trait Implementations§
impl<'a> Freeze for ForUrl<'a>
impl<'a> !RefUnwindSafe for ForUrl<'a>
impl<'a> Send for ForUrl<'a>
impl<'a> Sync for ForUrl<'a>
impl<'a> Unpin for ForUrl<'a>
impl<'a> !UnwindSafe for ForUrl<'a>
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