nostrdb-rs

nostrdb in rust!
git clone git://jb55.com/nostrdb-rs
Log | Files | Refs | Submodules | README | LICENSE

commit c2343b5732f348e74eec6004a2f6a26193beb0b6
parent c86355d7e0b6c493b587ef3dbf1f71e4eb3be3b4
Author: William Casarin <jb55@jb55.com>
Date:   Mon, 22 Jul 2024 16:27:44 -0700

add ndb_unsubscribe

Signed-off-by: William Casarin <jb55@jb55.com>

Diffstat:
Msrc/ndb.rs | 12++++++++++++
1 file changed, 12 insertions(+), 0 deletions(-)

diff --git a/src/ndb.rs b/src/ndb.rs @@ -117,6 +117,18 @@ impl Ndb { } } + pub fn unsubscribe(&self, sub_id: u64) -> Result<()> { + let r = unsafe { + bindings::ndb_unsubscribe(self.as_ptr(), sub_id) + }; + + if r == 0 { + Err(Error::SubscriptionError) + } else { + Ok(()) + } + } + pub fn subscribe(&self, filters: Vec<Filter>) -> Result<Subscription> { unsafe { let mut ndb_filters: Vec<bindings::ndb_filter> =