Skip to content

Commit a376709

Browse files
committed
database: impl Any for NostrDatabase
This allows downcasting `NostrDatabase` trait to concrete database types. Pull-Request: #918 Signed-off-by: Yuki Kishimoto <[email protected]>
1 parent 3847dab commit a376709

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040

4141
- nostr: rework `NostrParser` ([Yuki Kishimoto] at https://github.com/rust-nostr/nostr/pull/899)
4242
- nostr: impl `Any` for `NostrSigner` ([Yuki Kishimoto] at https://github.com/rust-nostr/nostr/pull/918)
43+
- database: impl `Any` for `NostrDatabase` ([Yuki Kishimoto] at https://github.com/rust-nostr/nostr/pull/918)
4344
- pool: refine notification sending depending on event database saving status ([Yuki Kishimoto] at https://github.com/rust-nostr/nostr/pull/911)
4445

4546
### Added

crates/nostr-database/src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#![warn(clippy::large_futures)]
1010
#![allow(clippy::mutable_key_type)] // TODO: remove when possible. Needed to suppress false positive for `BTreeSet<Event>`
1111

12+
use std::any::Any;
1213
use std::collections::HashMap;
1314
use std::fmt::Debug;
1415
use std::sync::Arc;
@@ -140,7 +141,7 @@ where
140141
}
141142

142143
/// Nostr (Events) Database
143-
pub trait NostrDatabase: Debug + Send + Sync {
144+
pub trait NostrDatabase: Any + Debug + Send + Sync {
144145
/// Name of the backend database used
145146
fn backend(&self) -> Backend;
146147

0 commit comments

Comments
 (0)