Releases: okready/scratchpad
Releases · okready/scratchpad
1.3.0
Added
- Stable toolchain
alloccrate support forno_stdcode via thealloc
feature. This requires Rust 1.36 or later. ByteDatasupport forstd::mem::MaybeUninittypes that wrap other
ByteDatatypes (e.g.MaybeUninit<usize>) when using Rust 1.36 or later
or when theunstablefeature is enabled.
Changed
- Add
local_inner_macrosmodifier to utility macro declarations
(array_type_for_bytes!,cache_aligned_zeroed_for_markers!, etc.),
allowing them to be imported individually viausestatements in Rust 2018
code without needing to import any other macros that they may call. - Update example and test code to use
std::mem::MaybeUninitas appropriate
when working with uninitialized memory. The now-deprecated
std::mem::uninitialized()function is only used for tests on legacy
systems and is not included in any generated documentation. - Include recommendations to use arrays and slices of
std::mem::MaybeUninit
elements if possible for uninitialized memory storage to the documentation
forScratchpad::static_new(),Scratchpad::static_new_in_place(),
uninitialized_boxed_slice(),uninitialized_boxed_slice_for_bytes(), and
uninitialized_boxed_slice_for_markers(), as well as a note in the "Known
Issues" section of the crate-level documentation. - Add
#[repr(C)]attribute toCacheAlignedin order to guarantee
consistent data layout.CacheAlignedis correctly sized and aligned in
practice with the default Rustrepr, but the Rustreprtechnically
doesn't guarantee any specific data layout; specifying theCreprhelps
us avoid any edge cases that may arise. Existing code should still behave as
normal. - Updated Travis CI configuration to use
clippyandrustfmtfrom the
stable toolchain, and updated the code accordingly (based on the 1.36.0
toolchain versions). - Various minor API documentation improvements.
1.2.0
Added
CStrallocation support, including conversion ofCStrallocations to
[u8]allocations.- Implementation of
StableDereffor
Allocation, allowing allocations to be used with other crates that support
the trait such as
owning_refand
rental.
Fixed
- Minor documentation fixes.
1.1.0
Added
Scratchpad::static_new_in_place()for initializing aScratchpadwithin
a block of uninitialized memory forScratchpadtypes that use only static
arrays for backing memory, bypassing potential call stack use for parameters
and return values that may exceed the amount of space available on the
stack.
1.0.1
Fixed
- Use unaligned reads and writes in
Tracking::get()andTracking::set()
implementations forBuffertypes to avoid potential issues with marker
tracking buffers that are not aligned to at least the same alignment as
usize, asBufferdoesn't guarantee any specific alignment, and some CPU
architectures do not allow unaligned access. This can impact performance,
but retains compatibility with code that may be using tracking buffers with
lower alignment requirements.
1.0.0
Added
IntoMutSliceLikePtrtrait for reinterpreting pointer types to compatible
SliceLikepointers. This replaces theIntoSliceLikeAllocationtrait for
determining whichAllocationtypes can be converted to slices and
slice-like types.- Missing support for converting
strallocations to[u8]allocations.
Changed
- Moved
into_slice_like_allocation()away from theIntoSliceLikeAllocation
trait into a method ofAllocationitself, allowing it to be called
directly on any allocation without having to import any special traits. - Rewrote much of the crate-level documentation to be more useful as well as
better reflect the changes made since the initial release.
Removed
IntoSliceLikeAllocationtrait (superseded by
Allocation::into_slice_like_allocation()andIntoMutSliceLikePtrtrait).
1.0.0-beta.2
Added
SliceSourcetrait for providing slice data toMarkerfunctions from
various source data types.SliceMoveSourcesubtrait ofSliceSourcethat allows for taking ownership
of the contents of a slice.SliceSourceCollectiontrait for abstracting collections ofSliceSource
objects.SliceMoveSourceCollectionsubtrait ofSliceSourceCollectionthat allows
for taking ownership of the slices provided by allSliceSourceobjects in
a collection.Marker::concat_slices()function for concatenating slices by moving their
contents into the new allocation.
Changed
- Overhauled
Markerfunctions that work with slices to take slice input
using the newSliceSource,SliceMoveSource,SliceSourceCollection, and
SliceMoveSourceCollectiontraits, allowing for more flexible input for
slice data. Additionally, the inputs for these functions are now more
consistent with one another. - Renamed
IntoSliceAllocationtoIntoSliceLikeAllocationand updated its
methods accordingly for consistency with other traits that work with
SliceLiketypes. - Unconditionally enable
i128andu128implementations ofByteDataif
therustcversion detected at build time is 1.26 or later.
Removed
OwnedSlicetrait (superseded bySliceSourceand its related traits).- Automatic coercion of scalar values (including boxed scalars) and boxed
arrays into slices when used as arguments forMarker::allocate_slice(),
Marker::extend(), and the relatedMarkerFrontandMarkerBackwrappers.
Support for scalars previously resulted in ambiguity when trying to
determine whether an array or slice reference should be interpreted as a
slice of its contents or a single-element slice containing either the array
or slice reference, requiring explicit type annotations in such cases. On
the other hand, support for boxed arrays simply becomes difficult to
implement when using the newly addedArraytrait, so they've simply been
removed in response. Both can still be used as input via explicit conversion
into a supported type. - Miscellaneous unnecessary generic parameters.
Fixed
- Check for the correct feature ("unstable" versus "nightly") in the
cfg
attributes used to control whetherByteDataimplementations are generated
fori128andu128.
1.0.0-beta.1
Added
Marker::allocate_slice(),Marker::allocate_slice_clone(), and
Marker::allocate_slice_copy()for creating slice allocations.Allocation::concat()andAllocation::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 theMarkertrait using theextend{,_clone,_copy}()
methods (appending is always performed by front markers, and prepending is
always performed by back markers).IntoSliceAllocationtrait for safely coercingAllocationinstances into
allocations of slices. This is also used to determine what types can be used
for allocation concatenation (concat()andconcat_unchecked()allocation
methods) and extension (append*()andprepend*()marker methods).SliceLiketrait for performing conversions between DSTs that essentially
wrap some primitive slice type and the underlying slice type (e.g. between
strand[u8]), andConcatenateSlicetrait for markingSliceLike
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
Errorenum with anErrorstruct that provides the
error category (anErrorKindenum variant based on the oldErrorenum)
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()withMarker::concat_slices_clone()and
Marker::concat_slices_copy(), which both work on general slices. - Use
NonNull<T>for internal storage ofAllocationpointers, allowing for
compiler optimizations such as reducingOption<Allocation<'marker, T>>
size to that of a single pointer.
0.3.0
Added
Marker::concat()for concatenating a series of strings into a single
string slice allocated from the marker on which it is called.#[inline]attribute to mostMarkerallocation functions and the
uninitialized_boxed_slice*()utility functions.
Changed
- Replaced data reference in
Allocationwith a raw pointer, allowing the
removal of the nebulous'tlifetime in theAllocationtype andMarker
methods (conceptually, anAllocationinstance owns its data, and this
helps clarify that ownership).
Removed
- Reference to creating static instances of
Scratchpadfrom README
(overlooked when correcting the crate documentation for version 0.2.0).
0.2.0
Added
Scratchpad::static_new()function for creating scratchpads backed by
static arrays without having to pass array instances as function parameters.StaticBuffertrait for constrainingScratchpad::static_new()to
scratchpads that use only static arrays for backing storage.cache_aligned_zeroed!(),cache_aligned_zeroed_for_bytes!(), and
cache_aligned_zeroed_for_markers!()macros for shorthand creation of
zeroed-outCacheAligneddata.- References to
MarkerFrontandMarkerBackin documentation forMarker. - Run tests with both the
stdandunstablecrate features enabled in
Travis CI configuration. - "data-structures" and "embedded" categories in
Cargo.tomlmanifest. - Documentation link in
Cargo.tomlmanifest. - Documentation and release nodes links in
README.md. - Changelog.
Changed
- Clarified how the front and back allocation stacks operate independently in
documentation. - Use clearer wording in "Memory Overhead" documentation section.
- Minor documentation tweaks.
Removed
- References to creating static instances of
Scratchpadfrom documentation
(static variables must implementSync, butScratchpadis not thread-safe
by design).
Fixed
- Incorrect "deque" term use internally.