Skip to content

Commit 1659ce4

Browse files
committed
doc(sdk): Add doc for assert_items_eq!.
1 parent 5d771ca commit 1659ce4

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -964,6 +964,18 @@ mod tests {
964964
LinkedChunkError, Position,
965965
};
966966

967+
/// A macro to test the items and the gap of a `LinkedChunk`.
968+
/// A chunk is delimited by `[` and `]`. An item chunk has the form `[a, b,
969+
/// c]` where `a`, `b` and `c` are items. A gap chunk has the form `[-]`.
970+
///
971+
/// For example, here is an assertion of 7 chunks: 1 items chunk, 1 gap
972+
/// chunk, 2 items chunks, 1 gap chunk, 2 items chunk. `a` is the oldest
973+
/// item of the oldest chunk (the first chunk), and `i` is the oldest (and
974+
/// newest) item of the newest chunk (the last chunk).
975+
///
976+
/// ```rust,no_run
977+
/// assert_items_eq!(linked_chunk, ['a'] [-] ['b', 'c', 'd'] ['e'] [-] ['f', 'g', 'h'] ['i']);
978+
/// ```
967979
macro_rules! assert_items_eq {
968980
( @_ [ $iterator:ident ] { [-] $( $rest:tt )* } { $( $accumulator:tt )* } ) => {
969981
assert_items_eq!(

0 commit comments

Comments
 (0)