ChangeStream + bindings
parent
95430f2997
commit
2e424b43df
@ -0,0 +1,33 @@
|
|||||||
|
//! Access to a MongoDB change stream.
|
||||||
|
use super::collection::Collection;
|
||||||
|
|
||||||
|
use mongoc::bindings;
|
||||||
|
|
||||||
|
pub struct ChangeStream<'a> {
|
||||||
|
_collection: &'a Collection<'a>,
|
||||||
|
inner: *mut bindings::mongoc_change_stream_t
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<'a> ChangeStream<'a> {
|
||||||
|
#[doc(hidden)]
|
||||||
|
pub fn new(
|
||||||
|
_collection: &'a Collection<'a>,
|
||||||
|
inner: *mut bindings::mongoc_change_stream_t
|
||||||
|
) -> Self {
|
||||||
|
Self {
|
||||||
|
_collection,
|
||||||
|
inner
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<'a> Drop for ChangeStream<'a> {
|
||||||
|
fn drop(&mut self) {
|
||||||
|
assert!(!self.inner.is_null());
|
||||||
|
unsafe {
|
||||||
|
bindings::mongoc_change_stream_destroy(self.inner);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,4 @@
|
|||||||
|
#[test]
|
||||||
|
fn test_change_stream() {
|
||||||
|
assert_eq!(true, true);
|
||||||
|
}
|
Loading…
Reference in New Issue