pub trait RecordMapper: Send + Sync {
type Item: Clone + Send + Sync;
// Required methods
fn record_type(&self) -> &str;
fn header(&self, item: &Self::Item) -> ItemHeader;
fn encode(&self, item: &Self::Item, record: &mut RawRecord);
fn decode(&self, record: &RawRecord) -> Result<Self::Item, String>;
// Provided methods
fn record_name(&self, id: &str) -> String { ... }
fn tombstone_keep_fields(&self) -> &[&str] { ... }
}Expand description
Domain <-> wire mapping for the one syncable item type.
Required Associated Types§
Required Methods§
fn record_type(&self) -> &str
fn header(&self, item: &Self::Item) -> ItemHeader
Provided Methods§
Sourcefn record_name(&self, id: &str) -> String
fn record_name(&self, id: &str) -> String
Record name for an item id (default: the id itself).
Sourcefn tombstone_keep_fields(&self) -> &[&str]
fn tombstone_keep_fields(&self) -> &[&str]
Extra fields a tombstone keeps beyond id/updatedAt/deletedAt.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".