1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
use crate::{Payload, ServerTimestamp};
#[derive(Debug, Clone)]
pub struct RecordChangeset<P> {
pub changes: Vec<P>,
pub timestamp: ServerTimestamp,
pub collection: std::borrow::Cow<'static, str>,
}
pub type IncomingChangeset = RecordChangeset<(Payload, ServerTimestamp)>;
pub type OutgoingChangeset = RecordChangeset<Payload>;
impl<T> RecordChangeset<T> {
#[inline]
pub fn new(
collection: impl Into<std::borrow::Cow<'static, str>>,
timestamp: ServerTimestamp,
) -> RecordChangeset<T> {
RecordChangeset {
changes: vec![],
timestamp,
collection: collection.into(),
}
}
}