subscription.rs (369B)
1 use crate::{Ndb, SubscriptionStream}; 2 3 #[derive(Debug, Clone, Copy, Eq, PartialEq, Hash)] 4 pub struct Subscription(u64); 5 6 impl Subscription { 7 pub fn new(id: u64) -> Self { 8 Self(id) 9 } 10 pub fn id(self) -> u64 { 11 self.0 12 } 13 14 pub fn stream(&self, ndb: &Ndb) -> SubscriptionStream { 15 SubscriptionStream::new(ndb.clone(), *self) 16 } 17 }