pub struct Simulation(/* private fields */);Implementations§
Source§impl Simulation
impl Simulation
pub fn new() -> Self
pub fn with_clock(clock: Arc<dyn Clock>) -> Self
Sourcepub fn set_strict(&self, strict: bool)
pub fn set_strict(&self, strict: bool)
Strict by default: unmatched requests fail. Set false to deliberately pass them through.
pub fn set_conditions(&self, conditions: Conditions)
pub fn conditions(&self) -> Conditions
Sourcepub fn handle(
&self,
matches: impl Fn(&str, &str) -> bool + Send + Sync + 'static,
handler: impl Fn(Prepared) -> Result<Reply, HttpError> + Send + Sync + 'static,
)
pub fn handle( &self, matches: impl Fn(&str, &str) -> bool + Send + Sync + 'static, handler: impl Fn(Prepared) -> Result<Reply, HttpError> + Send + Sync + 'static, )
First matching rule wins. Predicate receives method and full URL; match origins explicitly rather than relying on a loose substring when passthrough is enabled.
pub fn route( &self, method: &str, url: &str, handler: impl Fn(Prepared) -> Result<Reply, HttpError> + Send + Sync + 'static, )
pub fn websocket( &self, matches: impl Fn(&str, &str) -> bool + Send + Sync + 'static, handler: impl Fn(Message) -> Result<Message, HttpError> + Send + Sync + 'static, )
pub fn websocket_echo(&self, url: &str)
pub fn requests(&self) -> Vec<RequestRecord>
pub fn request_count(&self, method: &str, url: &str) -> u64
Trait Implementations§
Source§impl Clone for Simulation
impl Clone for Simulation
Source§impl Default for Simulation
impl Default for Simulation
Source§impl Transport for Simulation
impl Transport for Simulation
fn capabilities(&self) -> Capabilities
Source§fn start(&self, req: Prepared, events: Events) -> Arc<dyn Transfer> ⓘ
fn start(&self, req: Prepared, events: Events) -> Arc<dyn Transfer> ⓘ
Start an exchange. Events may arrive before this returns.
The platform store’s cookies, for
Cookies::Platform.Forget the platform store’s cookies.
Source§fn clear_cache(&self)
fn clear_cache(&self)
Empty the platform cache.
Auto Trait Implementations§
impl !RefUnwindSafe for Simulation
impl !UnwindSafe for Simulation
impl Forget for Simulation
impl Freeze for Simulation
impl Move for Simulation
impl Send for Simulation
impl Sync for Simulation
impl Unpin for Simulation
impl UnsafeUnpin for Simulation
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