Skip to content

1.0.0-beta.1

Pre-release
Pre-release
Compare
Choose a tag to compare
@okready okready released this 25 May 07:25
· 76 commits to 1.x since this release

Added

  • Marker::allocate_slice(), Marker::allocate_slice_clone(), and
    Marker::allocate_slice_copy() for creating slice allocations.
  • Allocation::concat() and Allocation::concat_unchecked() for
    concatenating two adjacent allocations into a single slice allocation.
  • MarkerFront::append{,_clone,_copy}() and
    MarkerBack::prepend{,_clone,_copy}() for extending existing allocations at
    the end of their respective stacks with new data. This functionality is also
    available through the Marker trait using the extend{,_clone,_copy}()
    methods (appending is always performed by front markers, and prepending is
    always performed by back markers).
  • IntoSliceAllocation trait for safely coercing Allocation instances into
    allocations of slices. This is also used to determine what types can be used
    for allocation concatenation (concat() and concat_unchecked() allocation
    methods) and extension (append*() and prepend*() marker methods).
  • SliceLike trait for performing conversions between DSTs that essentially
    wrap some primitive slice type and the underlying slice type (e.g. between
    str and [u8]), and ConcatenateSlice trait for marking SliceLike
    types that can be safely concatenated without any additional verification
    needed. This is used to allow for general use of such DSTs in allocations.
  • Various unit tests for edge cases (e.g. allocation extension safety, ZST
    allocation support).

Changed

  • Replaced the simple Error enum with an Error struct that provides the
    error category (an ErrorKind enum variant based on the old Error enum)
    and any values whose ownership was intended to be passed to the callee. This
    allows the caller to reuse such values if an operation fails instead of
    simply throwing them away.
  • Replaced Marker::concat() with Marker::concat_slices_clone() and
    Marker::concat_slices_copy(), which both work on general slices.
  • Use NonNull<T> for internal storage of Allocation pointers, allowing for
    compiler optimizations such as reducing Option<Allocation<'marker, T>>
    size to that of a single pointer.