elasticsearch_dsl/search/highlight/
matched_fields.rs

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