From c3d5778aaea3a92924a2d28ef6af107bb54e173f Mon Sep 17 00:00:00 2001 From: mposmta Date: Mon, 6 Apr 2020 20:05:31 +0200 Subject: [PATCH] allows to get names from schema --- meilisearch-schema/src/schema.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/meilisearch-schema/src/schema.rs b/meilisearch-schema/src/schema.rs index 64f622501..7645ae50b 100644 --- a/meilisearch-schema/src/schema.rs +++ b/meilisearch-schema/src/schema.rs @@ -79,6 +79,10 @@ impl Schema { self.fields_map.name(id) } + pub fn names(&self) -> impl Iterator { + self.fields_map.iter().map(|(k, _)| k.as_ref()) + } + pub fn contains(&self, name: &str) -> bool { self.fields_map.id(name).is_some() }