File tree Expand file tree Collapse file tree 2 files changed +6
-4
lines changed
star_frame/src/unsize/impls Expand file tree Collapse file tree 2 files changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -127,7 +127,9 @@ where
127127 self . list . get ( index)
128128 }
129129
130- /// Adds a value to the set. Returns whether the value was already present. If the value is already present, the set is unchanged.
130+ /// Adds a value to the set.
131+ ///
132+ /// Returns whether the value was newly inserted. If the value is already present, the set is unchanged and `false` is returned.
131133 ///
132134 /// # Examples
133135 ///
Original file line number Diff line number Diff line change @@ -168,7 +168,7 @@ where
168168 }
169169 }
170170
171- /// Inserts or modifies an item into the map, returning true if the item already existed , and false otherwise.
171+ /// Inserts or modifies an item into the map, returning true if the item was newly inserted , and false otherwise.
172172 #[ exclusive]
173173 pub fn insert < I > ( & mut self , key : K , value : I ) -> Result < bool >
174174 where
@@ -179,12 +179,12 @@ where
179179 // TODO: optimize this by just modifying bytes to fit and then writing to them
180180 self . list ( ) . remove ( existing_index) ?;
181181 self . list ( ) . insert_with_offset ( existing_index, value, key) ?;
182- Ok ( true )
182+ Ok ( false )
183183 }
184184 Err ( insertion_index) => {
185185 self . list ( )
186186 . insert_with_offset ( insertion_index, value, key) ?;
187- Ok ( false )
187+ Ok ( true )
188188 }
189189 }
190190 }
You can’t perform that action at this time.
0 commit comments