elsa icon indicating copy to clipboard operation
elsa copied to clipboard

Add docs and doctests for methods

Open Manishearth opened this issue 3 years ago • 2 comments

Would be nice if the methods had docs and doctests. A lot of this can be copied from std

Manishearth avatar Mar 15 '21 06:03 Manishearth

What does insert return? From the code it calls or_insert, which means that it returns the value that is already in the map, and throws away the argument? This is different than other map-like APIs that return back the argument if the insertion failed.

sffc avatar Oct 18 '22 23:10 sffc

It always returns the value inside the map, with no replacement, since that's the only operation that can work here. This should probably be documented better, and a version that returns (&V::Target, Option<V>) would be kinda nice to have as well

Manishearth avatar Oct 19 '22 00:10 Manishearth