component: impl Debug for Expect

Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
This commit is contained in:
Maxime “pep” Buquet 2022-09-10 22:29:00 +02:00
parent 35e323f448
commit ab9f824dec
Signed by: pep
GPG key ID: DEDA74AEECA9D0F2

View file

@ -6,6 +6,7 @@
use crate::error::Error;
use std::fmt;
use std::marker::Send;
use std::ops::{Deref, DerefMut};
use std::pin::Pin;
@ -80,6 +81,17 @@ enum Expect {
Callback(Box<dyn FnOnce(Element) + Send + 'static>),
}
impl fmt::Debug for Expect {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "Expect::")?;
match self {
Expect::Element(el) => write!(f, "Element({:?})", String::from(el)),
Expect::Callback(_) => write!(f, "Callback(<cb>)"),
}
}
}
#[derive(Debug)]
pub struct TestComponent {
in_buffer: Vec<Element>,
out_buffer: Vec<Element>,