NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
crates.io
crates.io, #1581 most downloaded on crates.io
Implementation detail of the konst crate
Latest stable
0.2.19
Last release 4 years ago
no release in 18 months
Release timing varies
gaps range from 2 weeks to 10 months
Nearly every release is documented
notes for 11 of 12 stable releases
Nothing withdrawn
no release was ever pulled
6 years old
12 releases · first in 2021
Drag across the ruler to compare, or tap a release to open it.
This release adds const equivalents of iterators, string splitting functions, const slice iterators, and a few other minor features.
This release adds const equivalents of iterators, string splitting functions, const slice iterators, and a few other minor features.
This is the changelog, summarising changes in each version(some minor changes may be ommited).
Addeded konst::iter module, with const encodings of Iterator API:
konst::iter::collect_const (macro)konst::iter::eval (macro)konst::iter::for_each (macro)konst::iter::into_iter (macro)konst::iter::iterator_dsl (documentation module)konst::iter::IntoIterWrapper (struct)konst::iter::IsIntoIterKind (struct)konst::iter::IsIteratorKind (struct)konst::iter::IsNonIteratorKind (struct)konst::iter::IsStdKind (struct)konst::iter::IntoIterKind(trait)Added these const fn (enabled by the "rust_1_64" feature):
konst::string::splitkonst::string::rsplitkonst::string::split_terminatorkonst::string::rsplit_terminatorkonst::string::split_oncekonst::string::rsplit_onceAdded these const string iterators (enabled by the "rust_1_64" feature):
konst::string::Splitkonst::string::RSplitkonst::string::SplitTerminatorkonst::string::RSplitTerminatorAdded these slice functions:
konst::slice::chunks(requires the "rust_1_64" feature)konst::slice::chunks_exact(requires the "rust_1_64" feature)konst::slice::iterkonst::slice::iter_copied(requires the "rust_1_61" feature)konst::slice::windows (requires the "rust_1_64" feature)Added these slice iterator types:
konst::slice::Chunks (requires the "rust_1_64" feature)konst::slice::ChunksRev (requires the "rust_1_64" feature)konst::slice::ChunksExact (requires the "rust_1_64" feature)konst::slice::ChunksExactRev (requires the "rust_1_64" feature)konst::slice::Iterkonst::slice::IterRevkonst::slice::IterCopied (requires the "rust_1_61" feature)konst::slice::IterCopiedRev (requires the "rust_1_61" feature)konst::slice::Windows (requires the "rust_1_64" feature)konst::slice::WindowsRev (requires the "rust_1_64" feature)Added range iterator types:
konst::range::RangeIterkonst::range::RangeIterRevkonst::range::RangeInclusiveIterkonst::range::RangeInclusiveIterRevkonst::range::RangeFromIterAdded konst::option::copied function (requires the "rust_1_61" feature)
Added "rust_1_51" feature, made "const_generics" feature delegate to it.
Added "rust_1_57" feature, which enables the "rust_1_56" feature.
Added "rust_1_61" feature, which enables the "rust_1_57" feature.
Changed "rust_1_64" feature: now it enables "rust_1_61" feature.
Added "rust_latest_stable" feature that enables the latest "rust_*" feature.
Added "rust_1_64" crate feature, to make slice indexing take constant time from Rust 1.64.0 onwards.
Changed "constant_time_slice" to enable "rust_1_64" feature.
Made "deref_raw_in_fn" feature only require Rust 1.56.0 by stopping the use of an (already stabilized) nightly feature flag.
Your coding agent can read these notes before it upgrades. Set up the MCP server →
Made "deref_raw_in_fn" feature only require Rust 1.56.0 by stopping the use of an (already stabilized) nightly feature flag.
Made "deref_raw_in_fn" feature only require Rust 1.56.0 by stopping the use of an (already stabilized) nightly feature flag.
This release adds many const equivalents of MaybeUninit, ManuallyDrop, raw pointer, and NonNull methods.
This release adds many const equivalents of MaybeUninit, ManuallyDrop, raw pointer, and NonNull methods.
The changes since the last release on Github
Added these functions:
konst::manually_drop::as_inner (requires the "rust_1_56" feature).konst::manually_drop::as_inner_mut (requires the "mut_refs" feature).Added these MaybeUninit functions:
konst::maybe_uninit::array_assume_init (requires the "rust_1_56" feature)konst::maybe_uninit::as_mut_ptr (requires the "mut_refs" feature)konst::maybe_uninit::as_ptrkonst::maybe_uninit::assume_init_mut (requires the "mut_refs" feature)konst::maybe_uninit::assume_init_ref (requires the "rust_1_56" feature)konst::maybe_uninit::assume_init (requires the "rust_1_56" feature)konst::maybe_uninit::uninit_array (requires the "rust_1_56" feature)konst::maybe_uninit::write (requires the "mut_refs" feature)Added these raw pointer/NonNull functins:
konst::ptr::as_mut (requires the "mut_refs" feature)konst::ptr::as_ref (requires the "rust_1_56" feature)konst::ptr::deref_mut (requires the "mut_refs" feature)konst::ptr::deref (requires the "rust_1_56" feature)konst::ptr::is_null (requires the "rust_1_56" feature)konst::ptr::non_null::as_mut (requires the "mut_refs" feature)konst::ptr::non_null::as_ref (requires the "rust_1_56" feature)konst::ptr::non_null::from_mut (requires the "mut_refs" feature)konst::ptr::non_null::from_refkonst::ptr::non_null::new (requires the "rust_1_56" feature)Added konst::array::map, which requires the rust_1_56 feature.
Added konst::map, which requires the rust_1_56 feature.
Added konst::array::map, which requires the rust_1_56 feature.
Nothing published for this version
Renamed these functions, reexported with old name, and deprecated the reexport:
Added many const equivalents of [T] and str functions.
Added "rust_1_55" and "rust_1_56" features.
Change: functions that required the "deref_raw_in_fn" feature can be used on Rust 1.56.0 (whenever that reaches stable) with the "rust_1_56" feature.
Added these slice functions
konst::slice::bytes_find_keepkonst::slice::bytes_find_skipkonst::slice::bytes_rfind_keepkonst::slice::bytes_rfind_skipkonst::slice::bytes_trim_end_matcheskonst::slice::bytes_trim_endkonst::slice::bytes_trim_matcheskonst::slice::bytes_trim_start_matcheskonst::slice::bytes_trim_startkonst::slice::bytes_trimkonst::slice::get_from_mut (requires the "mut_refs" feature)konst::slice::get_fromkonst::slice::get_mut (requires the "mut_refs" feature)konst::slice::get_range_mut (requires the "mut_refs" feature)konst::slice::get_rangekonst::slice::get_up_to_mut (requires the "mut_refs" feature)konst::slice::get_up_tokonst::slice::getAdded these str functions, all of which require the "rust_1_55" feature:
konst::string::from_utf8konst::string::get_fromkonst::string::get_rangekonst::string::get_up_tokonst::string::split_atkonst::string::str_fromkonst::string::str_rangekonst::string::strip_prefixkonst::string::strip_suffixkonst::string::str_up_tokonst::string::trimkonst::string::trim_startkonst::string::trim_endkonst::string::trim_matcheskonst::string::trim_start_matcheskonst::string::trim_end_matcheskonst::string::find_skipkonst::string::find_keepkonst::string::rfind_skipkonst::string::rfind_keepRenamed these functions, reexported with old name, and deprecated the reexport:
string::str_starts_with: renamed to string::starts_withstring::str_ends_with: renamed to string::ends_withstring::str_find: renamed to string::findstring::str_contains: renamed to string::containsstring::str_rfind: renamed to string::rfindstring::str_rcontains: renamed to string::rcontainsAdded the konst::string::from_utf8 macro.
Added konst::string::Utf8Error error struct.
Fixed internal soundness bug in where unions weren't #[repr(C))].
Fixed internal soundness bug in where unions weren't #[repr(C))].
This release adds const fn equivalents of mutable reference methods.
This release adds const fn equivalents of mutable reference methods.
Added the "mut_refs", "nightly_mut_refs" features for const fns that take mutable references.
Added these mutable slice functions:
konst::slice::first_mutkonst::slice::last_mutkonst::slice::slice_from_mutkonst::slice::slice_range_mutkonst::slice::slice_up_to_mutkonst::slice::split_at_mutkonst::slice::split_first_mutkonst::slice::split_last_mutkonst::slice::try_into_array_mutThis release adds a mechanism for doing type-dispatched parsing, and makes some macros more permissive.
This release adds a mechanism for doing type-dispatched parsing, and makes some macros more permissive.
Added ParseFor trait and parse_with macro, for type-dispatched parsing.
Added StdParser struct as the parser for std types.
Broadened valid syntax for try_rebind/rebind_if_ok
Added trailing comma support to every macros, where applicable
This release adds some (generic)constants for common types (usable in [CONST; LEN]), slice::try_into_array macro and nightly function to convert &[T]
This release adds some (generic)constants for common types (usable in [CONST; LEN]), slice::try_into_array macro and nightly function to convert &[T] to &[T; N], and more functions for splitting slices.
Fixed handling of length argument of slice::try_into_array macro, when the "const_generics" feature is enabled.
It would previously require non-trivial expressions to be wrapped in braces.
Added the slice::try_into_array macro and nightly function to try to convert &[T] to &[T; N]
Defined the slice::TryIntoArrayError as the error type for slice::try_into_array
Added slice::{first, last, split_first, split_last} functions, const equivalents of the slice methods.
Added these (generic) constants, which can be used in [CONST; LEN] even for non-Copy types:
option::NONE: alias for Nonealloc_type::COW_STR_NEW: An empty Cow<'_, str<alloc_type::COW_SLICE_NEW: An empty Cow<'_, [T]>alloc_type::STRING_NEW: An empty Stringalloc_type::VEC_NEW}: An empty Vec<T>maybe_uninit::UNINIT: An uninit MaybeUninit<T>maybe_uninit::UNINIT_ARRAY: An uninit [MaybeUninit<T>; LEN]Added "deref_raw_in_fn" feature to enable const fns that need to dereference raw pointers, requires the nightly compiler.
Added "alloc" feature to enable the alloc_type module.
Added the slice::try_into_array macro and nightly function to try to convert &[T] to &[T; N]
Added the slice::try_into_array macro and nightly function to try to convert &[T] to &[T; N]
Defined the slice::TryIntoArrayError as the error type for slice::try_into_array
Added slice::{first, last, split_first, split_last} functions, const equivalents of the slice methods.
Added these (generic) constants, which can be used in [CONST; LEN] even for non-Copy types:
option::NONE: alias for Nonealloc_type::COW_STR_NEW: An empty Cow<'_, str<alloc_type::COW_SLICE_NEW: An empty Cow<'_, [T]>alloc_type::STRING_NEW: An empty Stringalloc_type::VEC_NEW}: An empty Vec<T>maybe_uninit::UNINIT: An uninit MaybeUninit<T>maybe_uninit::UNINIT_ARRAY: An uninit [MaybeUninit<T>; LEN]Added "deref_raw_in_fn" feature to enable const fns that need to dereference raw pointers, requires the nightly compiler.
Added "alloc" feature to enable the alloc_type module.
Breaking change: tightened the syntax of the parse_any macro, now it requires the last branch in the match-like syntax to be _ => , forbidding _ patte…
The first release here, with many const equivalents of std functions(including equality/order comparison), const fn-based parsing API.
A Copy of the changelog until now
Breaking change: tightened the syntax of the parse_any macro, now it requires the last branch in the match-like syntax to be _ => <expression>, forbidding _ patterns in other branches.
Added support for these Parser methods in parse_any:
find_skip - rfind_skip - trim_start_matches - trim_end_matchesMoved these functions from slice::cmp to slice, and reexported back in slice::cmp:
cmp_slice_u8: renamed to cmp_byteseq_slice_u8: renamed to eq_bytescmp_option_slice_u8: renamed to cmp_option_byteseq_option_slice_u8: renamed to eq_option_bytes
The above *_bytes functions do not require any cargo features to use.Added comparison functions for &[usize], &[isize], Option<&[usize]>, Option<&[isize]>
Defined the konst_proc_macros crate 0.1.0, for internal use by konst.
Defined equality and ordering comparison functions for:
All the primitive types, including integers, bool, char, and Options of them,
inside the primitives::cmp module.
Ranges and RangeInclusives of all unsigned integer types, inside the range::cmp module.
All the NonZero* types, and Option<NonZero*> types, inside the nonzero::cmp module.
&str and Option<&str>, inside the string module.
Ordering, Option<Ordering>, PhantomData<T>, PhantomPinned, inside the other::cmp module.
Slices of integers, &[bool], &[char], &[&str], &[&[u8]], and Options of them, inside the slice::cmp module.
Defined the polymorphism module, to do type-based overloading, currently limited to const_eq and const_cmp methods.
Defined these items in the polymorphism module:
CmpWrapper: Wrapper type which implements many methods for std types, currently only const_eq and const_cmp.
ConstCmpMarker: Trait for describing whether a type is from the standard library, and has const_eq and/or const_cmp methods.
IsAConstCmpMarker: Helper type used to automatically coerce standard library types into CmpWrapper, and leaving non-std ones unwrapped.
IsArrayKind, IsNotStdKind, IsStdKind: for describing the kind of type something is.
Declared these functions in the slice module:
bytes_contain, bytes_end_with , bytes_find , bytes_rcontain , bytes_rfind , bytes_start_with, bytes_strip_prefix , bytes_strip_suffix , slice_from , slice_range , slice_up_to , split_at.
Declared these functions in the string module:
str_contains, str_ends_with, str_find, str_rcontains, str_rfind, str_starts_with
Declared the parsing module with:
Parser: A parser constructible from &[u8] or &str.
ParseError: The error type returned by fallible Parser methods.
ErrorKind: Enum for the kinds of parsing errors that happened, included inside ParseError
ParseDirection: Enum for the direction a parser is currently parsing from, either the end or the start.
ParseValueResult: Type alias for the Result types that Parser returns when parsing types.
ParserResult: Type alias for Result<'a, Parser, ParseError>
Reexporting these types in the root module:
parsing::{Parser}
string::{cmp_str, eq_str, cmp_option_str, eq_option_str},
Declared these macros:
coerce_to_cmp: For coercing values to types with const_eq or const_cmp methods.
const_cmp, const_cmp_for, const_eq, const_eq_for: for comparing values
for_range: for iterating over a range.
impl_cmp: For implementing ConstCmpMarker for multiple types, and declaring const_eq/const_cmp.
konst: For emulating inline const (const{ }).
parse_any: For calling Parser methods with multiple alternative string literal patterns.
rebind_if_ok: if let Ok which rebinds variables instead of shadowing them.
try_equal: For returning early when an ordering isn't Ordering::Equal
try_rebind: For returning early on Err, rebinding variables on Ok.
unwrap_ctx: Unwraps a Result, calling .panic() on the error value on error.
unwrap_opt_or: Const-equivalent of Option::unwrap_or and Option::unwrap_or_else.
unwrap_res_or: Const-equivalent of Result::unwrap_or and Result::unwrap_or_else.
Defined these cargo features:
"cmp"(enabled by default): Enables all the comparison functions and macros.
"parsing"(enabled by default): Enables the parsing module, macros, and compiles the konst_proc_macros crate.
"constant_time_slice": Improves the performance of certain slice functions from taking linear time to constant time. Requires Rust nightly.
"const_generics": Enables impls that use const generics, instead of being implemented for small arrays. Requires Rust 1.51.0 .
One column per quarter.