mirror of
https://github.com/matrix-org/matrix-rust-sdk.git
synced 2026-05-15 03:25:46 -04:00
feat(sdk): Implement Clone on LinkedChunkUpdate.
`LinkedChunkUpdate` implements `Clone` if and only if `Item` and `Gap` both implement `Clone`.
This commit is contained in:
@@ -96,6 +96,35 @@ pub enum LinkedChunkUpdate<Item, Gap> {
|
||||
},
|
||||
}
|
||||
|
||||
impl<Item, Gap> Clone for LinkedChunkUpdate<Item, Gap>
|
||||
where
|
||||
Item: Clone,
|
||||
Gap: Clone,
|
||||
{
|
||||
fn clone(&self) -> Self {
|
||||
match self {
|
||||
Self::NewItemsChunk { previous, new, next } => Self::NewItemsChunk {
|
||||
previous: previous.clone(),
|
||||
new: new.clone(),
|
||||
next: next.clone(),
|
||||
},
|
||||
Self::NewGapChunk { previous, new, next, gap } => Self::NewGapChunk {
|
||||
previous: previous.clone(),
|
||||
new: new.clone(),
|
||||
next: next.clone(),
|
||||
gap: gap.clone(),
|
||||
},
|
||||
Self::RemoveChunk(identifier) => Self::RemoveChunk(identifier.clone()),
|
||||
Self::InsertItems { at, items } => {
|
||||
Self::InsertItems { at: at.clone(), items: items.clone() }
|
||||
}
|
||||
Self::TruncateItems { chunk, length } => {
|
||||
Self::TruncateItems { chunk: chunk.clone(), length: length.clone() }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// A collection of [`LinkedChunkUpdate`].
|
||||
///
|
||||
/// Get a value for this type with [`LinkedChunk::updates`].
|
||||
|
||||
Reference in New Issue
Block a user