pub struct Any {}
Expand description
Matches on every message it sees. This will rarely be used in combination with other matchers, since it will respond to all messages.
Implementations§
source§impl Any
impl Any
sourcepub fn new() -> Any
pub fn new() -> Any
Examples found in repository?
examples/any_match.rs (line 14)
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
pub async fn main() {
let server = WsMockServer::start().await;
WsMock::new()
.matcher(Any::new())
.respond_with(Message::Text("Hello World".to_string()))
.expect(1)
.mount(&server)
.await;
let (stream, _resp) = connect_async(server.uri().await)
.await
.expect("Connecting failed");
let (mut send, mut recv) = stream.split();
send.send(Message::from("some message")).await.unwrap();
let mut received = Vec::new();
while let Ok(Some(Ok(message))) = timeout(Duration::from_millis(100), recv.next()).await {
received.push(message);
}
server.verify().await;
assert_eq!(vec![Message::Text("Hello World".to_string())], received);
}
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Any
impl RefUnwindSafe for Any
impl Send for Any
impl Sync for Any
impl Unpin for Any
impl UnwindSafe for Any
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