diff options
author | Matthias Beyer <mail@beyermatthias.de> | 2023-01-05 12:51:36 +0100 |
---|---|---|
committer | Matthias Beyer <mail@beyermatthias.de> | 2023-01-09 11:10:51 +0100 |
commit | 2e23c858ff5266b53e61cd8acdf646ebdff5249f (patch) | |
tree | 31bab8b39ae42f6da9dafad0ddeab0e44a75fc74 /mqtt-tester | |
parent | 9319ae417237f5902c91f73e3ea7979f2778a0bf (diff) |
Make Output::wait_for private and return read bytes
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
Diffstat (limited to 'mqtt-tester')
-rw-r--r-- | mqtt-tester/src/command.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/mqtt-tester/src/command.rs b/mqtt-tester/src/command.rs index d1103df..74a8eb2 100644 --- a/mqtt-tester/src/command.rs +++ b/mqtt-tester/src/command.rs @@ -57,7 +57,7 @@ pub struct Output { } impl Output { - pub async fn wait_for(&mut self, expected_bytes: &[u8]) -> miette::Result<()> { + async fn wait_for(&mut self, expected_bytes: &[u8]) -> miette::Result<Vec<u8>> { let mut buf = vec![0; expected_bytes.len()]; match tokio::time::timeout( std::time::Duration::from_millis(100), @@ -77,7 +77,7 @@ impl Output { Ok(Err(e)) => return Err(e).into_diagnostic(), Err(_elapsed) => return Err(miette::miette!("Did not hear from server until timeout")), } - Ok(()) + Ok(buf) } pub async fn wait_for_packet<'m, P>(&mut self, packet: P) -> miette::Result<()> @@ -90,7 +90,7 @@ impl Output { .write_to(std::pin::Pin::new(&mut buf)) .await .into_diagnostic()?; - self.wait_for(&buf).await + self.wait_for(&buf).await.map(|_| ()) } pub async fn wait_and_check(&mut self, check: CheckBytesFn) -> miette::Result<()> { |