rust-lang / wg-allocators

Home of the Allocators working group: Paving a path for a standard set of allocator traits to be used in collections!
http://bit.ly/hello-wg-allocators
207 stars 9 forks source link

Missing methods for returning excess in Alloc #13

Closed TimDiekmann closed 4 years ago

TimDiekmann commented 5 years ago

Returning Excess when allocating is useful for collections like (Raw)Vec. Currently, only these methods are provided:

In order to make those collection work with the excess api, these methods have to be added:

adlerd commented 4 years ago

Is there a discussion somewhere about why X_excess isn't just called X; i.e., all of the "default" functions return the actual allocation size which can be used or ignored? Are there allocators which have different behavior when _excess is called (and should that behavior be supported)?

TimDiekmann commented 4 years ago

@adlerd Sorry, somehow I haven't noticed your question. Yes, #17 proposes to remove the usable_size API and rename the x_excess to x.