pub(super) trait TimelineItemStore: Sized {
type Item: IsA<TimelineItem>;
type Data: TimelineItemData;
// Required methods
fn items(&self) -> Vec<Self::Item>;
fn create_item(&self, data: &Self::Data) -> Self::Item;
fn update_item(&self, item: &Self::Item, data: &Self::Data);
fn apply_item_diff_list(
&self,
item_diff_list: Vec<TimelineItemDiff<Self::Item>>,
);
// Provided methods
fn can_minimize_diff_list(
&self,
diff_list: &[VectorDiff<Self::Data>],
) -> bool { ... }
fn minimize_diff_list(&self, diff_list: Vec<VectorDiff<Self::Data>>) { ... }
}
Expand description
Trait to access data from a type that store TimelineItem
s.
Required Associated Types§
type Item: IsA<TimelineItem>
type Data: TimelineItemData
Required Methods§
Sourcefn create_item(&self, data: &Self::Data) -> Self::Item
fn create_item(&self, data: &Self::Data) -> Self::Item
Create a TimelineItem
with the given TimelineItemData
.
Sourcefn update_item(&self, item: &Self::Item, data: &Self::Data)
fn update_item(&self, item: &Self::Item, data: &Self::Data)
Update the given item with the given timeline ID.
Sourcefn apply_item_diff_list(
&self,
item_diff_list: Vec<TimelineItemDiff<Self::Item>>,
)
fn apply_item_diff_list( &self, item_diff_list: Vec<TimelineItemDiff<Self::Item>>, )
Apply the given list of item diffs to this store.
Provided Methods§
Sourcefn can_minimize_diff_list(&self, diff_list: &[VectorDiff<Self::Data>]) -> bool
fn can_minimize_diff_list(&self, diff_list: &[VectorDiff<Self::Data>]) -> bool
Whether the given diff list can be minimized by calling
minimize_diff_list
.
It can be minimized if there is more than 1 item in the list and if the
list only includes supported VectorDiff
variants.
Sourcefn minimize_diff_list(&self, diff_list: Vec<VectorDiff<Self::Data>>)
fn minimize_diff_list(&self, diff_list: Vec<VectorDiff<Self::Data>>)
Minimize the given diff list and apply it to this store.
Panics if the diff list contains unsupported VectorDiff
variants. This
will never panic if can_minimize_diff_list
returns true
.
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.