From 3f88c7b2df80ec3170120403e71aae599cf12f89 Mon Sep 17 00:00:00 2001 From: William Casarin Date: Tue, 16 Jul 2024 10:03:12 -0700 Subject: [PATCH] scratch that, just add a method that we need Signed-off-by: William Casarin --- src/filter.rs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/filter.rs b/src/filter.rs index 4ba681c..5a7d66f 100644 --- a/src/filter.rs +++ b/src/filter.rs @@ -170,15 +170,15 @@ impl FilterBuilder { self.start_tags_field('p'); } - pub fn start_tag_field(&mut self, tag: char) { + fn start_tag_field(&mut self, tag: char) { unsafe { bindings::ndb_filter_start_tag_field(self.as_mut_ptr(), tag as u8 as c_char) }; } - pub fn end_field(&mut self) { + fn end_field(&mut self) { unsafe { bindings::ndb_filter_end_field(self.as_mut_ptr()) } } - pub fn events(&mut self, events: Vec<[u8; 32]>) -> &mut Self { + pub fn events(&mut self, events: Vec<&[u8; 32]>) -> &mut Self { self.start_tag_field('e'); for ref id in events { self.add_id_element(id); @@ -187,6 +187,13 @@ impl FilterBuilder { self } + pub fn event(&mut self, id: &[u8; 32]) -> &mut Self { + self.start_tag_field('e'); + self.add_id_element(id); + self.end_field(); + self + } + pub fn ids(&mut self, ids: Vec<[u8; 32]>) -> &mut Self { self.start_ids_field(); for ref id in ids {