Skip to content

Commit 66f4123

Browse files
committed
Extended doc comments on MapOperation and MapMessage.
1 parent 8633434 commit 66f4123

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

api/swimos_agent_protocol/src/model.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,17 +58,20 @@ impl<T> LaneResponse<T> {
5858
/// to describe alterations to the lane.
5959
#[derive(Copy, Clone, Debug, PartialEq, Eq, Form)]
6060
pub enum MapOperation<K, V> {
61+
/// Update the value associated with a key in the map (or insert an entry if they key does not exist).
6162
#[form(tag = "update")]
6263
Update {
6364
key: K,
6465
#[form(body)]
6566
value: V,
6667
},
68+
/// Remove an entry from the map, by key (does nothing if there is no such entry).
6769
#[form(tag = "remove")]
6870
Remove {
6971
#[form(header)]
7072
key: K,
7173
},
74+
/// Remove all entries in the map.
7275
#[form(tag = "clear")]
7376
Clear,
7477
}
@@ -79,21 +82,29 @@ pub enum MapOperation<K, V> {
7982
/// with other implementations.
8083
#[derive(Copy, Clone, Debug, PartialEq, Eq, Form, Hash)]
8184
pub enum MapMessage<K, V> {
85+
/// Update the value associated with a key in the map (or insert an entry if they key does not exist).
8286
#[form(tag = "update")]
8387
Update {
8488
key: K,
8589
#[form(body)]
8690
value: V,
8791
},
92+
/// Remove an entry from the map, by key (does nothing if there is no such entry).
8893
#[form(tag = "remove")]
8994
Remove {
9095
#[form(header)]
9196
key: K,
9297
},
98+
/// Remove all entries in the map.
9399
#[form(tag = "clear")]
94100
Clear,
101+
/// Retain only the first `n` entries in the map, the remainder are removed. The ordering
102+
/// used to determine 'first' is the Recon order of the keys. If there are fewer than `n`
103+
/// entries in the map, this does nothing.
95104
#[form(tag = "take")]
96105
Take(#[form(header_body)] u64),
106+
/// Remove the first `n` entries in the map. The ordering used to determine 'first' is the
107+
/// Recon order of the keys. If there are fewer than `n` entries in the map, it is cleared.
97108
#[form(tag = "drop")]
98109
Drop(#[form(header_body)] u64),
99110
}

0 commit comments

Comments
 (0)