pub trait Driver:
Clone
+ Send
+ Sync
+ 'static {
type Error: Error + Send + 'static;
type EvStream: Stream<Item = Result<Item, Self::Error>> + Unpin + Send + 'static;
// Required methods
fn watch(
&self,
server_id: Uid,
ns: &str,
) -> impl Future<Output = Result<Self::EvStream, Self::Error>> + Send;
fn emit(
&self,
data: &Item,
) -> impl Future<Output = Result<(), Self::Error>> + Send;
}
Expand description
The driver trait can be used to support different MongoDB backends. It must share handlers/connection between its clones.
Required Associated Types§
Required Methods§
Sourcefn watch(
&self,
server_id: Uid,
ns: &str,
) -> impl Future<Output = Result<Self::EvStream, Self::Error>> + Send
fn watch( &self, server_id: Uid, ns: &str, ) -> impl Future<Output = Result<Self::EvStream, Self::Error>> + Send
Watch for document insertions on the collection. This should be implemented by change streams but could be implemented by anything else.
The implementation should take care of filtering the events.
It must pass events that originate from our server and if the target is set it should pass events
sent for us. Here is the corresponding filter:
origin != self.uid && (target == null || target == self.uid)
.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.