1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
/// Matched fields logic with type conversions
#[derive(Clone, Default, PartialEq, Eq, Serialize)]
pub struct MatchedFields(Vec<String>);
impl std::fmt::Debug for MatchedFields {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
self.0.fmt(f)
}
}
impl<T> From<T> for MatchedFields
where
T: IntoIterator,
T::Item: ToString,
{
fn from(value: T) -> Self {
Self(value.into_iter().map(|x| x.to_string()).collect())
}
}