Skip to content

rethink the purpose of the smallvec! / smallvec_inline! macros #432

Description

@alejandro-vaz

ft. #424 @bolshoytoster

these macros are essentially wrappers around the associated functions SmallVec::from and SmallVec::from_buf.

rust policy with macros, as written on the rust book, is simple: don't make a macro out of which can be made as a function

thus they seem very redundant

their origins trace to Vec API parity and a hack that had to be placed in 2021 in order to please the CTFE

conceptually:

smallvec![1u8, 2, 3] ~= SmallVec::from([1u8, 2, 3]);

smallvec_inline![1u8, 2, 3] ~= SmallVec::from_buf([1u8, 2, 3]);

alternatives

  • keep the macros as they are now
  • redesign the smallvec_inline! macro to be a wrapper of ::from_buf as smallvec! is of ::from
  • remove the macros and accept that their only reason of being was Vec API parity

Metadata

Metadata

Assignees

Labels

good first issueGood for a first contributorhelp wantedNo clear candidate to implement it

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions