Skip to content

Commit 69ddc2a

Browse files
committed
feat(sdk): Update RoomEvents::replace_gap_at to return a &Chunk.
1 parent cc205c9 commit 69ddc2a

File tree

1 file changed

+7
-4
lines changed
  • crates/matrix-sdk/src/event_cache

1 file changed

+7
-4
lines changed

crates/matrix-sdk/src/event_cache/store.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
use std::{fmt, iter::once, result::Result};
15+
use std::{fmt, iter::once};
1616

1717
use matrix_sdk_common::deserialized_responses::SyncTimelineEvent;
1818

@@ -103,16 +103,19 @@ impl RoomEvents {
103103
///
104104
/// Because the `gap_identifier` can represent non-gap chunk, this method
105105
/// returns a `Result`.
106+
///
107+
/// The returned `Chunk` represents the newly created `Chunk` that contains
108+
/// the first events.
106109
pub fn replace_gap_at<I>(
107110
&mut self,
108-
items: I,
111+
events: I,
109112
gap_identifier: ChunkIdentifier,
110-
) -> Result<(), LinkedChunkError>
113+
) -> Result<&Chunk<SyncTimelineEvent, Gap, DEFAULT_CHUNK_CAPACITY>, LinkedChunkError>
111114
where
112115
I: IntoIterator<Item = SyncTimelineEvent>,
113116
I::IntoIter: ExactSizeIterator,
114117
{
115-
self.chunks.replace_gap_at(items, gap_identifier)
118+
self.chunks.replace_gap_at(events, gap_identifier)
116119
}
117120

118121
/// Search for a chunk, and return its identifier.

0 commit comments

Comments
 (0)