konst
Const equivalents of std functions, compile-time comparison, and parsing
0.4.3
29M downloads/mo
#1687 most downloaded on crates.io
rodrimati1992/konst
What this package is like to depend on
Last release 4 months ago
16 Apr 2026
Release timing varies
gaps range from 8 days to 8 months
Most releases are documented
notes for 30 of 43 stable releases
3 versions withdrawn
withdrawn after publishing
5 years old
46 releases · first in 2021
4 releases in the last 12 months
see the full history below
Release timeline
46 releases · Mar 2021 to Apr 2026Releases
latest 46-
0.4.302 Nov 2025Release notes
Open source →This release adds a
destructure_recmacro for nested destructuring into maybe-Drop types andArrayBuilder::{extend_from_array, extend_from_slice}methods.Changelog
0.4.3
Added
"konst_proc_macros"featureChanged
"parsing_proc"feature to also enable the"konst_proc_macros"feature.Added
ArrayBuilder::{extend_from_array, extend_from_slice}methodsAdded
destructure_recmacro (requires"konst_proc_macros"feature)Release notes
Open source →Added
"konst_proc_macros"featureChanged
"parsing_proc"feature to also enable the"konst_proc_macros"feature.Added
ArrayBuilder::{extend_from_array, extend_from_slice}methodsAdded
destructure_recmacro (requires"konst_proc_macros"feature) -
0.4.205 Sep 2025Release notes
Open source →This release features the
from_fn_ndandmap_ndarray macros for supporting non-local returns in const, andmap_while,reduce,step_byiterator methods.Changelog
0.4.2
Added these methods to iterator macros:
map_whilereducestep_by
Fixed support of iterators of drop type in iterator macros. Previously drop items could only be produced by iterator methods, the input iterator could not be drop itself, now it can be.
Changed implementations of
"cmp"-feature-requiring methods inkonst::iter::evalto support drop types.Added these macros in
konst::array(these require the"iter"feature):konst::array::from_fn_ndkonst::array::map_nd
Added
of_assumed_nondropconstructors to:konst::array::ArrayBuilderkonst::array::IntoIter
Added reexport of
const_panic::unwrap_errinkonst::resultRelease notes
Open source →Added these methods to iterator macros:
map_whilereducestep_by
Fixed support of iterators of drop type in iterator macros. Previously drop items could only be produced by iterator methods, the input iterator could not be drop itself, now it can be.
Changed implementations of
"cmp"-feature-requiring methods inkonst::iter::evalto support drop types.Added these macros in
konst::array(these require the"iter"feature):konst::array::from_fn_ndkonst::array::map_nd
Added
of_assumed_nondropconstructors to:konst::array::ArrayBuilderkonst::array::IntoIter
Added reexport of
const_panic::unwrap_errinkonst::result -
0.4.117 Aug 2025Nothing published for this version
-
0.4.017 Aug 2025Release notes
Open source →This release features:
- the change from using methods that take and return
Selfby value to using&mut selffor mutating methods (which unlocks being able to iterate over arrays by value!) - many "cmp"-feature-based methods in iterator macros
- many new slice and Option const-equivalents of std methods
among other changes.
Changelog
0.4.0
0.4.0
Removed these items because there is an equivalent built-in replacement:
konst::alloc_type::COW_STR_NEW: replaced byconst { Cow::Borrowed("") }konst::alloc_type::STRING_NEW: replaced byconst { String::new() }konst::alloc_type::VEC_NEW: replaced byconst { Vec::new() }konst::chr::from_u32_uncheckedkonst::chr::from_u32konst::ffi::cstr:CStrconstructors are const, unwrappable withkonst::result::unwrapkonst::konstmacro: replaced byconst { }blockskonst::maybe_uninit::as_mut_ptrkonst::maybe_uninit::as_ptrkonst::maybe_uninit::assume_init_refkonst::maybe_uninit::assume_initkonst::maybe_uninit::UNINIT: replaced byconst { MaybeUninit::uninit() }konst::option::copiedkonst::option::flattenkonst::option::NONE: replaced byconst { None }konst::option::unwrapkonst::primitive::parse_i*functions: replaced by integerfrom_str_radixmethods, unwrappable withkonst::result::unwrapkonst::primitive::parse_u*functions: replaced by integerfrom_str_radixmethods, unwrappable withkonst::result::unwrapkonst::ptr::as_mut: replaced by&mut *pointerkonst::ptr::as_ref: replaced by&*pointerkonst::ptr::nonnull::as_mutkonst::ptr::nonnull::as_refkonst::slice::as_chunkskonst::slice::as_rchunkskonst::slice::bytes_trim_end: replaced by<[u8]>::trim_ascii_endkonst::slice::bytes_trim_start: replaced by<[u8]>::trim_ascii_startkonst::slice::bytes_trim: replaced by<[u8]>::trim_asciikonst::slice::first_mutkonst::slice::last_mutkonst::slice::split_first_mutkonst::slice::split_last_mutkonst::string::from_utf8konst::string::is_char_boundarystring::trim_end: replaced bystr::trim_ascii_endstring::trim_start: replaced bystr::trim_ascii_startstring::trim: replaced bystr::trim_ascii
(the items in the list above without an explicit reason were replaced by a method or function of the same name)
Removed these items because their unstable std equivalents were removed:
konst::slice::array_chunkskonst::slice::array_chunks_mutkonst::slice::ArrayChunkskonst::slice::ArrayChunksRevkonst::slice::ArrayChunksMutkonst::slice::ArrayChunksMutRev
Removed these functions due to having an unsound impl:
konst::ptr::is_nullkonst::ptr::nonnull::new
Removed these items because they are not needed anymore:
konst::rebind_if_okmacrokonst::try_rebindmacrokonst::polymorphism::type_eq_projection_fnmacro: replaced bytypewit::TypeFn+TypeEq::projectkonst::unwrap_ctxmacro: superceeded bykonst::result::unwrappanicmethods: superceeded byconst_panic::PanicFmtimplskonst::parsing::ParserResult: using the type it aliased instead of the aliaskonst::parsing::ParseValueResult: using the type it aliased instead of the aliaskonst::cmp::ConstCmpUnref: replaced byConstCmp::Thisassociated type
Constrained macros that take closures from taking functions through
:exprto:path, to keep the evaluation order of macros consistent with functions.Added these macros at the root module:
if_let_Somewhile_let_Some
Added
konst::drop_flavormodule with these items:DropFlavortraitDropFlavorWrappertraitMayDropmarker typeNonDropmarker typeunwrapfunctionas_innerfunctionas_inner_mutfunctionwrapfunction
Renameed
konst::array::{map_, from_fn_}macros tomapandfrom_fnrespectively, replacing the old macros of the same name in the process.Changes to
konst::array::ArrayConsumer:- renamed into
IntoIter - impld
ConstIntoIterfor it - changed its
next*methods to returnOption<T>instead ofOption<ManuallyDrop<T>>(to be consistent withConstIntoIterAPI). - added
D: DropFlavorparameter tokonst::array::IntoIterto make it sometimes not need dropping - replaced
newconstructor with newof_copyandof_dropconstructors. - added
into_copymethod - added
into_dropmethod - added
revmethod
Changes to
konst::array::ArrayBuilder- added
D: DropFlavortype parameter to make it sometimes not need dropping. - replaced
newconstructor with newof_copyandof_dropconstructors. - added
is_emptymethod - added
into_copymethod - added
into_dropmethod
Change: Made array items conditional on
"iter"feature:konst::array::ArrayBuilderkonst::array::from_fnkonst::array::IntoIterkonst::array::IntoIterRevkonst::array::map
Added
ConstIntoIterimpl for arrays that useskonst::array::IntoIter<T, L, MayDrop>as the iterator.Added
konst::array::IntoIterReviterator.Added these items for
ConstCmpoverhaul;konst::cmp::ConstCmp::Thisassociated typekonst::cmp::ConstCmpKindtraitkonst::cmp::CoerceTotype alias
Removed
IsRefKindreexport fromkonst::cmpand made it not a validConstCmp::KindMerged all inherent
coercemethods ofIsAConstCmpinto one generic method.Replaced
CmpWrapper::sliceconstructor withfrom_ref, which takes any&Tand converts it into&CmpWrapper<T>.Changed the precise type that
stdtypes are coerced into for havingconst_eqandconst_cmpmethods:- for arrays: instead of converting
&[T; N]toCmpWrapper<&[T]>, it's converted to&CmpWrapper<[T; N]> - slices: instead of converting
&[T]toCmpWrapper<&[T]>, it's converted to&<[T]> - strs: instead of converting
&strtoCmpWrapper<&str>, it's converted to&str - every other std type: instead of converting
&TtoCmpWrapper<T>, it's converted to&CmpWrapper<T>
Moved these macros to
konst::cmpmodule:coerce_to_cmpconst_cmpconst_cmp_forconst_eqconst_eq_forimpl_cmpmaxmax_bymax_by_keyminmin_bymin_by_keytry_equal
Changed
konst::cmp::{const_cmp_for, const_eq_for}to borrow their slice argumentsAdded these comparison macros:
konst::cmp::const_gekonst::cmp::const_ge_forkonst::cmp::const_gtkonst::cmp::const_gt_forkonst::cmp::const_lekonst::cmp::const_le_forkonst::cmp::const_ltkonst::cmp::const_lt_forkonst::cmp::const_nekonst::cmp::const_ne_for
Fixed how
const_cmp_formacro andconst_cmpmethods compared slices for ordering, they used to consider all slices less than all longer slices. Nowconst_cmp!(short_slice, longer_slice)only returnsLessif all elements ofshort_sliceare less than or equal to thelonger_sliceelements at the same index.Turned iterators from taking
Selfand returningOption<(Self::Item, Self)>into taking&mut Selfand returningOption<Self::Item>.Removed support for lifetime promotion in return value of iterator methods in iterator macros, i.e.: there's no guarantee that the returned reference be usable in the following methods.
Added
konst::iter::ConstIntoIter::ITEMS_NEED_DROPassociated constantAdded
konst::iter::ConstIntoIterKindtraitAdded
konst::iter::CoerceTotype aliasAdded
ConstIntoIterimpl for&mut impl ConstIntoIter<Kind = IsIteratorKind>, that is for mutable references to iterators.Added
ConstIntoIterKindbound toConstIntoIter::Kind.Turned
IntoIterWrapper::coercemethods into free function atkonst::iter::coerceAdded
konst::iter::{repeat_n, RepeatN}iterator constructor and iterator struct.Removed
rpositionmethod from iterator macros, since it returned the distance from the end, not the start (bugfix).Changed drop behavior for iterators in
iter::eval: iterators withConstIntoIter::ITEMS_NEED_DROP == trueare fully consumed after evaluating the methods passed to the macro, after which all iterators aremem::forget-ed.Changed
IntoIterWrapperto only be constructible bykonst::iter::coerce, and made its fields private.Fixed
revmethod of iterator macros: it can't be used ifenumerate/take/take_while/skip/skip_while/zipwere used before it, because the iterator without this restriction would produce different results thanstd::iter::Iteratorwould.Added these methods to
iter::evalmacro (conditional on "cmp" feature):cmpeqgegtis_sorted_by_keyis_sorted_byis_sortedleltmax_by_keymax_bymaxmin_by_keymin_byminne
Changed all of the
konst::parsing::Parsermethods to use&mut selfinstead of taking and returningParserby value, now every method mutates theParserin place instead of returning a newParsereach time.
The signatures ofkonst::parsing::Parsermethods were changed in this way:- for
(self) -> Selfmethods: changed into(&mut self) -> &mut Self - for
(self, ..) -> Result<(T, Self), E>methods: changed into(&mut self, ..) -> Result<T, E>. - for
(self, ..) -> Result<Self, E>methods: changed into(&mut self, ..) -> Result<&mut Self, E>.
Removed
Copyimpl forParser, addedcopymethod for explicit copying.Renamed
Parser::into_errortoto_errorand changed it from takingselfto taking&selfRenamed
Parser::into_other_errorintoto_other_error, and from takingselfto&self.Changed
ParseError::newto takeParserby reference.Changed
ParseError::other_errorto takeParserby reference.Changed signature of
ParseError::extra_messagefrom returning&strto&'static str(the former tied the lifetime parameter of&strto the lifetime of theParseErrorvalue)Renamed
parse_withtoparse_typeand moved tokonst::parsingMoved
parser_methodtokonst::parsingChanged the
parse_typemacro from takingkonst::parsing::Parserto automatically mutably borrowing it.Added
const_panic::PanicFmtimpls (used bykonst::result::unwrap) for:konst::parsing::ErrorKindkonst::parsing::ParseErrorkonst::parsing::ParseDirectionkonst::primiive::ParseBoolErrorkonst::slice::TryIntoArrayError
Changed
Optionmacros to requireOptionby value when the equivalent methods takesOptionby value (the macros used to allow passingOptionby reference)Added const equivalents of
Option-related items:konst::option::get_or_insert_with(macro)konst::option::get_or_insert(macro)konst::option::insert(macro)konst::option::into_iter(function, iterator constructor)konst::option::IntoIter(struct, iterator)konst::option::IntoIterRev(struct, iterator)konst::option::is_none_or(macro)konst::option::is_some_and(macro)konst::option::iter_mut(function, iterator constructor)konst::option::iter(function, iterator constructor)konst::option::Iter(struct, iterator)konst::option::IterMut(struct, iterator)konst::option::IterMutRev(struct, iterator)konst::option::IterRev(struct, iterator)konst::option::unzip(function)konst::option::zip(macro)
Added support for
Droptypes in someOptionmacros:konst::option::and_thenkonst::option::mapkonst::option::ok_or_elsekonst::option::or_elsekonst::option::unwrap_or_else
Added
ConstIntoIterimpls forOption<T>/&Option<T>/&mut Option<T>Added missing impls of
ConstCmpforRangeandRangeInclusivetypes over signed integers.Added
konst::range::OneSidedRangetrait (currently only used bykonst::slice::{split_off, split_off_mut})Added these items to
konst::slice:konst::slice::chunks_exact_mut(function, iterator constructor)konst::slice::chunks_mut(function, iterator constructor)konst::slice::ChunksExactMut(struct, iterator)konst::slice::ChunksExactMutRev(struct, iterator)konst::slice::ChunksMut(struct, iterator)konst::slice::ChunksMutRev(struct, iterator)konst::slice::fill_with(macro)konst::slice::fill(function)konst::slice::is_sorted_by_key(macro)konst::slice::is_sorted_by(macro)konst::slice::is_sorted(macro)konst::slice::iter_mut(function, iterator constructor)konst::slice::IterMut(struct, iterator)konst::slice::IterMutRev(struct, iterator)konst::slice::rchunks_exact_mut(function, iterator constructor)konst::slice::rchunks_mut(function, iterator constructor)konst::slice::RChunksExactMut(struct, iterator)konst::slice::RChunksExactMutRev(struct, iterator)konst::slice::RChunksMut(struct, iterator)konst::slice::RChunksMutRev(struct, iterator)konst::slice::split_off_first_mut(function)konst::slice::split_off_first(function)konst::slice::split_off_last_mut(function)konst::slice::split_off_last(function)konst::slice::split_off_mut(function)konst::slice::split_off(function)
Fixed
RSplitTerminator: it used to skip the empty string before the first instance of the delimiter, instead of the empty space after the last one.
The latter is whatRSplitTerminatordoes now, to be consistent with std.Removed
.rev()method ofkonst::string::{Split, RSplit}, because it allowed reversing an iterator with a&strneedle, whenstddoes not allow it (because the reverse iterator would produce different strings than forward).Reexported
const_panic::unwrap_okaskonst::result::unwrapChanged
Resultmacros to require passing Result by value whenever the equivalent method does.Changed
konst's edition to 2024 and Minimum Supported Rust Version to 1.89.0.Added crate features:
"const_panic_derive": to enableconst_panic's"derive"feature.
Removed these crate features since the features they enabled are now always enabled:
"rust_1_83""mut_refs""nightly_mut_refs"
Upgraded
const_panicdependency to 0.2.13, enabled its"rust_1_88"featureUpgraded
typewitdependency to 1.12, disabled its default feature, and enabled its"rust_1_83"feature.Release notes
Open source →Removed these items because there is an equivalent built-in replacement:
konst::alloc_type::COW_STR_NEW: replaced byconst { Cow::Borrowed("") }konst::alloc_type::STRING_NEW: replaced byconst { String::new() }konst::alloc_type::VEC_NEW: replaced byconst { Vec::new() }konst::chr::from_u32_uncheckedkonst::chr::from_u32konst::ffi::cstr:CStrconstructors are const, unwrappable withkonst::result::unwrapkonst::konstmacro: replaced byconst { }blockskonst::maybe_uninit::as_mut_ptrkonst::maybe_uninit::as_ptrkonst::maybe_uninit::assume_init_refkonst::maybe_uninit::assume_initkonst::maybe_uninit::UNINIT: replaced byconst { MaybeUninit::uninit() }konst::option::copiedkonst::option::flattenkonst::option::NONE: replaced byconst { None }konst::option::unwrapkonst::primitive::parse_i*functions: replaced by integerfrom_str_radixmethods, unwrappable withkonst::result::unwrapkonst::primitive::parse_u*functions: replaced by integerfrom_str_radixmethods, unwrappable withkonst::result::unwrapkonst::ptr::as_mut: replaced by&mut *pointerkonst::ptr::as_ref: replaced by&*pointerkonst::ptr::nonnull::as_mutkonst::ptr::nonnull::as_refkonst::slice::as_chunkskonst::slice::as_rchunkskonst::slice::bytes_trim_end: replaced by<[u8]>::trim_ascii_endkonst::slice::bytes_trim_start: replaced by<[u8]>::trim_ascii_startkonst::slice::bytes_trim: replaced by<[u8]>::trim_asciikonst::slice::first_mutkonst::slice::last_mutkonst::slice::split_first_mutkonst::slice::split_last_mutkonst::string::from_utf8konst::string::is_char_boundarystring::trim_end: replaced bystr::trim_ascii_endstring::trim_start: replaced bystr::trim_ascii_startstring::trim: replaced bystr::trim_ascii
(the items in the list above without an explicit reason were replaced by a method or function of the same name)
Removed these items because their unstable std equivalents were removed:
konst::slice::array_chunkskonst::slice::array_chunks_mutkonst::slice::ArrayChunkskonst::slice::ArrayChunksRevkonst::slice::ArrayChunksMutkonst::slice::ArrayChunksMutRev
Removed these functions due to having an unsound impl:
konst::ptr::is_nullkonst::ptr::nonnull::new
Removed these items because they are not needed anymore:
konst::rebind_if_okmacrokonst::try_rebindmacrokonst::polymorphism::type_eq_projection_fnmacro: replaced bytypewit::TypeFn+TypeEq::projectkonst::unwrap_ctxmacro: superceeded bykonst::result::unwrappanicmethods: superceeded byconst_panic::PanicFmtimplskonst::parsing::ParserResult: using the type it aliased instead of the aliaskonst::parsing::ParseValueResult: using the type it aliased instead of the aliaskonst::cmp::ConstCmpUnref: replaced byConstCmp::Thisassociated type
Constrained macros that take closures from taking functions through
:exprto:path, to keep the evaluation order of macros consistent with functions.Added these macros at the root module:
if_let_Somewhile_let_Some
Added
konst::drop_flavormodule with these items:DropFlavortraitDropFlavorWrappertraitMayDropmarker typeNonDropmarker typeunwrapfunctionas_innerfunctionas_inner_mutfunctionwrapfunction
Renameed
konst::array::{map_, from_fn_}macros tomapandfrom_fnrespectively, replacing the old macros of the same name in the process.Changes to
konst::array::ArrayConsumer:- renamed into
IntoIter - impld
ConstIntoIterfor it - changed its
next*methods to returnOption<T>instead ofOption<ManuallyDrop<T>>(to be consistent withConstIntoIterAPI). - added
D: DropFlavorparameter tokonst::array::IntoIterto make it sometimes not need dropping - replaced
newconstructor with newof_copyandof_dropconstructors. - added
into_copymethod - added
into_dropmethod - added
revmethod
Changes to
konst::array::ArrayBuilder- added
D: DropFlavortype parameter to make it sometimes not need dropping. - replaced
newconstructor with newof_copyandof_dropconstructors. - added
is_emptymethod - added
into_copymethod - added
into_dropmethod
Change: Made array items conditional on
"iter"feature:konst::array::ArrayBuilderkonst::array::from_fnkonst::array::IntoIterkonst::array::IntoIterRevkonst::array::map
Added
ConstIntoIterimpl for arrays that useskonst::array::IntoIter<T, L, MayDrop>as the iterator.Added
konst::array::IntoIterReviterator.Added these items for
ConstCmpoverhaul;konst::cmp::ConstCmp::Thisassociated typekonst::cmp::ConstCmpKindtraitkonst::cmp::CoerceTotype alias
Removed
IsRefKindreexport fromkonst::cmpand made it not a validConstCmp::KindMerged all inherent
coercemethods ofIsAConstCmpinto one generic method.Replaced
CmpWrapper::sliceconstructor withfrom_ref, which takes any&Tand converts it into&CmpWrapper<T>.Changed the precise type that
stdtypes are coerced into for havingconst_eqandconst_cmpmethods:- for arrays: instead of converting
&[T; N]toCmpWrapper<&[T]>, it's converted to&CmpWrapper<[T; N]> - slices: instead of converting
&[T]toCmpWrapper<&[T]>, it's converted to&<[T]> - strs: instead of converting
&strtoCmpWrapper<&str>, it's converted to&str - every other std type: instead of converting
&TtoCmpWrapper<T>, it's converted to&CmpWrapper<T>
Moved these macros to
konst::cmpmodule:coerce_to_cmpconst_cmpconst_cmp_forconst_eqconst_eq_forimpl_cmpmaxmax_bymax_by_keyminmin_bymin_by_keytry_equal
Changed
konst::cmp::{const_cmp_for, const_eq_for}to borrow their slice argumentsAdded these comparison macros:
konst::cmp::const_gekonst::cmp::const_ge_forkonst::cmp::const_gtkonst::cmp::const_gt_forkonst::cmp::const_lekonst::cmp::const_le_forkonst::cmp::const_ltkonst::cmp::const_lt_forkonst::cmp::const_nekonst::cmp::const_ne_for
Fixed how
const_cmp_formacro andconst_cmpmethods compared slices for ordering, they used to consider all slices less than all longer slices. Nowconst_cmp!(short_slice, longer_slice)only returnsLessif all elements ofshort_sliceare less than or equal to thelonger_sliceelements at the same index.Turned iterators from taking
Selfand returningOption<(Self::Item, Self)>into taking&mut Selfand returningOption<Self::Item>.Removed support for lifetime promotion in return value of iterator methods in iterator macros, i.e.: there's no guarantee that the returned reference be usable in the following methods.
Added
konst::iter::ConstIntoIter::ITEMS_NEED_DROPassociated constantAdded
konst::iter::ConstIntoIterKindtraitAdded
konst::iter::CoerceTotype aliasAdded
ConstIntoIterimpl for&mut impl ConstIntoIter<Kind = IsIteratorKind>, that is for mutable references to iterators.Added
ConstIntoIterKindbound toConstIntoIter::Kind.Turned
IntoIterWrapper::coercemethods into free function atkonst::iter::coerceAdded
konst::iter::{repeat_n, RepeatN}iterator constructor and iterator struct.Removed
rpositionmethod from iterator macros, since it returned the distance from the end, not the start (bugfix).Changed drop behavior for iterators in
iter::eval: iterators withConstIntoIter::ITEMS_NEED_DROP == trueare fully consumed after evaluating the methods passed to the macro, after which all iterators aremem::forget-ed.Changed
IntoIterWrapperto only be constructible bykonst::iter::coerce, and made its fields private.Fixed
revmethod of iterator macros: it can't be used ifenumerate/take/take_while/skip/skip_while/zipwere used before it, because the iterator without this restriction would produce different results thanstd::iter::Iteratorwould.Added these methods to
iter::evalmacro (conditional on "cmp" feature):cmpeqgegtis_sorted_by_keyis_sorted_byis_sortedleltmax_by_keymax_bymaxmin_by_keymin_byminne
Changed all of the
konst::parsing::Parsermethods to use&mut selfinstead of taking and returningParserby value, now every method mutates theParserin place instead of returning a newParsereach time. The signatures ofkonst::parsing::Parsermethods were changed in this way:- for
(self) -> Selfmethods: changed into(&mut self) -> &mut Self - for
(self, ..) -> Result<(T, Self), E>methods: changed into(&mut self, ..) -> Result<T, E>. - for
(self, ..) -> Result<Self, E>methods: changed into(&mut self, ..) -> Result<&mut Self, E>.
Removed
Copyimpl forParser, addedcopymethod for explicit copying.Renamed
Parser::into_errortoto_errorand changed it from takingselfto taking&selfRenamed
Parser::into_other_errorintoto_other_error, and from takingselfto&self.Changed
ParseError::newto takeParserby reference.Changed
ParseError::other_errorto takeParserby reference.Changed signature of
ParseError::extra_messagefrom returning&strto&'static str(the former tied the lifetime parameter of&strto the lifetime of theParseErrorvalue)Renamed
parse_withtoparse_typeand moved tokonst::parsingMoved
parser_methodtokonst::parsingChanged the
parse_typemacro from takingkonst::parsing::Parserto automatically mutably borrowing it.Added
const_panic::PanicFmtimpls (used bykonst::result::unwrap) for:konst::parsing::ErrorKindkonst::parsing::ParseErrorkonst::parsing::ParseDirectionkonst::primiive::ParseBoolErrorkonst::slice::TryIntoArrayError
Changed
Optionmacros to requireOptionby value when the equivalent methods takesOptionby value (the macros used to allow passingOptionby reference)Added const equivalents of
Option-related items:konst::option::get_or_insert_with(macro)konst::option::get_or_insert(macro)konst::option::insert(macro)konst::option::into_iter(function, iterator constructor)konst::option::IntoIter(struct, iterator)konst::option::IntoIterRev(struct, iterator)konst::option::is_none_or(macro)konst::option::is_some_and(macro)konst::option::iter_mut(function, iterator constructor)konst::option::iter(function, iterator constructor)konst::option::Iter(struct, iterator)konst::option::IterMut(struct, iterator)konst::option::IterMutRev(struct, iterator)konst::option::IterRev(struct, iterator)konst::option::unzip(function)konst::option::zip(macro)
Added support for
Droptypes in someOptionmacros:konst::option::and_thenkonst::option::mapkonst::option::ok_or_elsekonst::option::or_elsekonst::option::unwrap_or_else
Added
ConstIntoIterimpls forOption<T>/&Option<T>/&mut Option<T>Added missing impls of
ConstCmpforRangeandRangeInclusivetypes over signed integers.Added
konst::range::OneSidedRangetrait (currently only used bykonst::slice::{split_off, split_off_mut})Added these items to
konst::slice:konst::slice::chunks_exact_mut(function, iterator constructor)konst::slice::chunks_mut(function, iterator constructor)konst::slice::ChunksExactMut(struct, iterator)konst::slice::ChunksExactMutRev(struct, iterator)konst::slice::ChunksMut(struct, iterator)konst::slice::ChunksMutRev(struct, iterator)konst::slice::fill_with(macro)konst::slice::fill(function)konst::slice::is_sorted_by_key(macro)konst::slice::is_sorted_by(macro)konst::slice::is_sorted(macro)konst::slice::iter_mut(function, iterator constructor)konst::slice::IterMut(struct, iterator)konst::slice::IterMutRev(struct, iterator)konst::slice::rchunks_exact_mut(function, iterator constructor)konst::slice::rchunks_mut(function, iterator constructor)konst::slice::RChunksExactMut(struct, iterator)konst::slice::RChunksExactMutRev(struct, iterator)konst::slice::RChunksMut(struct, iterator)konst::slice::RChunksMutRev(struct, iterator)konst::slice::split_off_first_mut(function)konst::slice::split_off_first(function)konst::slice::split_off_last_mut(function)konst::slice::split_off_last(function)konst::slice::split_off_mut(function)konst::slice::split_off(function)
Fixed
RSplitTerminator: it used to skip the empty string before the first instance of the delimiter, instead of the empty space after the last one. The latter is whatRSplitTerminatordoes now, to be consistent with std.Removed
.rev()method ofkonst::string::{Split, RSplit}, because it allowed reversing an iterator with a&strneedle, whenstddoes not allow it (because the reverse iterator would produce different strings than forward).Reexported
const_panic::unwrap_okaskonst::result::unwrapChanged
Resultmacros to require passing Result by value whenever the equivalent method does.Changed
konst's edition to 2024 and Minimum Supported Rust Version to 1.89.0.Added crate features:
"const_panic_derive": to enableconst_panic's"derive"feature.
Removed these crate features since the features they enabled are now always enabled:
"rust_1_83""mut_refs""nightly_mut_refs"
Upgraded
const_panicdependency to 0.2.13, enabled its"rust_1_88"featureUpgraded
typewitdependency to 1.12, disabled its default feature, and enabled its"rust_1_83"feature.0.3
- the change from using methods that take and return
-
0.3.1716 Apr 2026Release notes
Open source →Fixed compilation error in
konst::ptrmodule on Rust nightly 2026-04-09. -
0.3.1629 Dec 2024Release notes
Open source →Deprecated these functions due to unsoundness:
konst::ptr::is_nullkonst::ptr::nonnull::new
-
0.3.1506 Dec 2024Release notes
Open source →This release enables all
&mut-taking const functions in Rust 1.83.0, providesArrayBuilder/ArrayConsumerarray helpers, and thekonst::manually_drop::takefunction.Changelog
0.3.15
Soft-removed
"mut_refs"and"nightly_mut_refs"feature (by hidding it in docs), changed to using"rust_1_83"feature to enable&mut-takingconst fns.
(to avoid breakage,"mut_refs"still enables items that use&mutin const by enabling"rust_latest_stable")Changed
"rust_latest_stable"feature to enable"rust_1_83"feature.Added
konst::manually_drop::takefunctionAdded these structs to
konst::array:ArrayBuilderArrayConsumer
0.3.14
Fixed accidental inclusion of private macros in docs.
Release notes
Open source →Soft-removed
"mut_refs"and"nightly_mut_refs"feature (by hidding it in docs), changed to using"rust_1_83"feature to enable&mut-takingconst fns. (to avoid breakage,"mut_refs"still enables items that use&mutin const by enabling"rust_latest_stable")Changed
"rust_latest_stable"feature to enable"rust_1_83"feature.Added
konst::manually_drop::takefunctionAdded these structs to
konst::array:ArrayBuilderArrayConsumer
-
0.3.1424 Nov 2024 -
0.3.1324 Nov 2024 withdrawnNothing published for this version
-
0.3.1222 Nov 2024 withdrawnRelease notes
Open source →This release adds closer const equivalents to
<[T; N]>::{from_fn, map}, without the limitations of the previous macro equivalents.Changelog
0.3.12
Changed
konst::array::from_fnmacro to allow unparenthesized type to the left of the `=>Added these macros in
konst::array(which require the"rust_1_83"feature):map_from_fn_
Release notes
Open source →Changed
konst::array::from_fnmacro to allow unparenthesized type to the left of the `=>Added these macros in
konst::array(which require the"rust_1_83"feature):map_from_fn_
-
0.3.1120 Nov 2024Nothing published for this version
-
0.3.1020 Nov 2024Release notes
Open source →This release adds a
destructuremacro to destructure (non-Drop) structs/tuples/arrays into their potentially fields/elements in const.
This macro requires the 1.83.0 Rust release, which will reach the stable channel on 2024-11-28.0.3
0.3.10
Added
"rust_1_83"feature, which enables the"mut_refs"feature.Added
"destructure"macro (requires the"rust_1_83"feature)Fixed future compatibility warnings
0.3.9
Defined these macros
max,max_by,max_by_key,min,min_by, andmin_by_keymacros.Re-exported these macros in the
konst::cmpmodule:coerce_to_cmpconst_cmpconst_cmp_forconst_eqconst_eq_forimpl_cmpmaxmax_bymax_by_keyminmin_bymin_by_key
Now the
foldandfoldrmethods inkonst::iter::evalcan take closures with type-annotated parameters (e.g:|accum: Bar, element: Qux| {)0.3.8
Removed most
Copyrestriction of these macros:konst::array::from_fnkonst::array::mapkonst::iter::collect_const
The pattern of the closure passed tokonst::array::mapis still required not to move out of the input array.
Improved
konst::array::{from_fn, map}macros by allowing its closure parameter to take more unparenthesized patterns.Improved the
konst::iter::{collect_const, eval, for_each}macros by allowing single-parameter closures passed to the macro to annotate the type of the parameter.Release notes
Open source →Added
"rust_1_83"feature, which enables the"mut_refs"feature.Added
"destructure"macro (requires the"rust_1_83"feature)Fixed future compatibility warnings
-
0.3.917 Apr 2024Release notes
Open source →Defined these macros
max,max_by,max_by_key,min,min_by, andmin_by_keymacros.Re-exported these macros in the
konst::cmpmodule:coerce_to_cmpconst_cmpconst_cmp_forconst_eqconst_eq_forimpl_cmpmaxmax_bymax_by_keyminmin_bymin_by_key
Now the
foldandfoldrmethods inkonst::iter::evalcan take closures with type-annotated parameters (e.g:|accum: Bar, element: Qux| {) -
0.3.806 Dec 2023Release notes
Open source →Removed most
Copyrestriction of these macros:konst::array::from_fnkonst::array::mapkonst::iter::collect_constThe pattern of the closure passed tokonst::array::mapis still required not to move out of the input array.
Improved
konst::array::{from_fn, map}macros by allowing its closure parameter to take more unparenthesized patterns.Improved the
konst::iter::{collect_const, eval, for_each}macros by allowing single-parameter closures passed to the macro to annotate the type of the parameter. -
0.3.728 Nov 2023Release notes
Open source →The 0.3.7 release adds a few chunky slice functions, and fixes an iterator method.
Changelog
0.3.7
Fixed
ChunksExact::remainder's implementation, it used to return the entire uniterated-over slice, when it should only return the part of the slice that the iterator never yields.Added these items to
konst::slicemodule:ArrayChunksRevstructArrayChunksstructRChunksExactRevstructRChunksExactstructRChunksRevstructRChunksstructarray_chunksfunctionas_chunksfunctionas_rchunksfunctionrchunks_exactfunctionrchunksfunction
0.3.6
Changed
type_eq_projection_fnmacro to not use anyunsafe, this may require fixing bounds in your code.0.3.5
Added
typewit = "1.1"dependency.Removed
konst::docsmodule.Replaced
konst::polymorphism::{HasTypeWitness,MakeTypeWitness,TypeWitnessTypeArg,TypeEq}from the same-named items intypewitAdded reexport of
typewit::{self, CallFn, simple_type_witness,TypeFn,type_fn}inkonst::polymorphism0.3.4
Fixed
Parser::parse_direction'sconst-ness by making it a const fn.Release notes
Open source →Fixed
ChunksExact::remainder's implementation, it used to return the entire uniterated-over slice, when it should only return the part of the slice that the iterator never yields.Added these items to
konst::slicemodule:ArrayChunksRevstructArrayChunksstructRChunksExactRevstructRChunksExactstructRChunksRevstructRChunksstructarray_chunksfunctionas_chunksfunctionas_rchunksfunctionrchunks_exactfunctionrchunksfunction
-
0.3.602 Aug 2023Release notes
Open source →Changed
type_eq_projection_fnmacro to not use anyunsafe, this may require fixing bounds in your code. -
0.3.501 May 2023Release notes
Open source →Added
typewit = "1.1"dependency.Removed
konst::docsmodule.Replaced
konst::polymorphism::{HasTypeWitness,MakeTypeWitness,TypeWitnessTypeArg,TypeEq}from the same-named items intypewitAdded reexport of
typewit::{self, CallFn, simple_type_witness,TypeFn,type_fn}inkonst::polymorphism -
0.3.411 Nov 2022 -
0.3.309 Nov 2022Nothing published for this version
-
0.3.209 Nov 2022Nothing published for this version
-
0.3.109 Nov 2022Nothing published for this version
-
0.3.008 Nov 2022Release notes
Open source →This release does many API cleanups and additions by using language features from the newest stable releases.
Changelog
Removed
konst::array::try_into_arraymacro (it's superceeded by the function of the same name)Removed these functions because the std equivalent is stably const:
konst::maybe_uninit::{as_ptr, assume_init, assume_init_ref}konst::ptr::{deref, deref_mut}konst::slice::{first, last, split_first, split_last}
Removed extra
fromparameter of:konst::slice::{bytes_contain, bytes_rcontain, bytes_find, bytes_rfind}konst::string::{find, contains, rfind, rcontains}
Added these items in
konst::polymorphism:HasTypeWitness(trait)MakeTypeWitness(trait)TypeEq(struct)TypeWitnessTypeArg(trait)type_eq_projection_fn(macro)
Added
konst::docs::type_witnessesdocumentation module.Added
konst::chrmodule, with these items:Utf8Encodedencode_utf8from_u32_uncheckedfrom_u32
Renamed
IntoIterKindtoConstIntoIter.Added
ItemandIntoIterassoc types to ConstIntoIter, and added checks in iterator macros thatItemmatches the item's type.Moved comparison-related from
konst::polymorphismto newkonst::cmpmodule.Renamed
ConstCmpMarkertoConstCmp.Renamed these marker types:
IsAConstCmpMarkertoIsAConstCmpIsIntoIterKindtoIsConstIntoIterIsNonIteratorKindtoIsIntoIterKind(not to be confused with the previous name for the traitConstIntoItertrait)
Removed
konst::polymorphism::IsArrayKindAdded
konst::polymorphism::IsRefKindAdded
konst::cmp::ConstCmpUnreftraits.Moved all
Is*Kindfield-less structs tokonst::polymorphism::kinds, made them all 0-variant enums, and reexported the relevant items inkonst::cmpandkonst::iter.Removed
ConstCmp::Thisassociated type, now it's derived withConstCmpUnref.Added
konst::slice::BytesPatterntrait, implemented forchar,[u8],[u8; N], andstr.Made the second parameter of
konst::slice::bytes_*functions take a genericBytesPattern.Added
konst::string::Patterntrait, implemented forcharand&strMade
stringfunctions takeP: Pattern<'s>as the pattern argument.Added
const_panic = "0.2"depdendency tokonstMade all panicking code use
const_panicto have the same error messages as at runtime (previously use array indexing hack to panic).Added
konst::array::from_fnmacro.Added
konst::iter::{repeat, Repeat}.Added iteration over ranges of non-usize integers and
char.Added
konst::iter::Steptrait.Added
konst::ffi::cstrmodule.Reexporting
konst::iter::step::Stepinkonst::iterAdded these
konst::stringitems:Chars(struct)RChars(struct)CharIndices(struct)RCharIndices(struct)char_indices(function)chars(function)from_iter(macro)is_char_boundary(function)str_concat(macro)str_join(macro)
Rewrote
Parserto only support parsing&str.Added
Parser::{skip, skip_back}methodsRemoved these parser functions:
Parser::*_bParser::*_u8(except forparse_u8)Parser::advance_*Parser::from_bytes
Renamed these
Parserfunctions:from_strtonew.bytestoremainder(and takes&str)
Added these
Parsermethods:into_other_errorrsplit_terminatorrsplitsplit_keepsplit_terminatorsplitskipskip_backtrimtrim_matcheswith_start_offset
Added
ParseError::other_errorfunction for constructingOthererrors with custom error messages.Added
FromBothvariant tokonst::parser::ParseDirectionRenamed
ParserFortrait toHasParserAdded
SplitExhausted,DelimiterNotFoundvariants tokonst::parsing::ErrorKindRemoved
map_errcapability oftry_rebinddue to being untested and unused.Removed
unwrap_opt_orandunwrap_res_ormacros (they are superceeded by other macros).Made
array::mapand iterator-taking macros support specifying an explicit return type.Added
assertc_eq,assertc_nemacros.Added type annotation support to
rebind_if_okmacro (for the pattern as a whole).Fixed support for
continueandbreakinside ofkonst::for_range.Changed
Parsermethods from taking&strpatterns to taking anyP: Pattern<'p>Renamed
parse_anymacro toparser_methodRemoved
konst::primitive::parse_*_bfunctionsRenamed
"parsing"feature to"parsing_proc"and"parsing_no_proc"feature to"parsing"Added
"iter"feature(enabled by default), feature-gating all iterator-related items.Added
"debug"feature for additional safety checks inkonstunsafe code.Made
konstcrate 2021 edition,resolver="2".Bumped minimum supported Rust versions to 1.65.0
Removed all
"rust_1_*"features, and all old-version-dependent code.Renamed
konst_macro_rulestokonst_kernelcrate, which defines items for reexporting inkonst(mostly needed for having macros in submodules).Release notes
Open source →Removed
konst::array::try_into_arraymacro (it's superceeded by the function of the same name)Removed functions
Removed these functions because the std equivalent is stably const:
konst::maybe_uninit::{as_ptr, assume_init, assume_init_ref}konst::ptr::{deref, deref_mut}konst::slice::{first, last, split_first, split_last}
Removed extra
fromparameter of:konst::slice::{bytes_contain, bytes_rcontain, bytes_find, bytes_rfind}konst::string::{find, contains, rfind, rcontains}
Added these items in
konst::polymorphism:HasTypeWitness(trait)MakeTypeWitness(trait)TypeEq(struct)TypeWitnessTypeArg(trait)type_eq_projection_fn(macro)
Added
konst::docs::type_witnessesdocumentation module.Added
konst::chrmodule, with these items:Utf8Encodedencode_utf8from_u32_uncheckedfrom_u32
Renamed
IntoIterKindtoConstIntoIter.Added
ItemandIntoIterassoc types to ConstIntoIter, and added checks in iterator macros thatItemmatches the item's type.Moved comparison-related from
konst::polymorphismto newkonst::cmpmodule.Renamed
ConstCmpMarkertoConstCmp.Renamed these marker types:
IsAConstCmpMarkertoIsAConstCmpIsIntoIterKindtoIsConstIntoIterIsNonIteratorKindtoIsIntoIterKind(not to be confused with the previous name for the traitConstIntoItertrait)
Removed
konst::polymorphism::IsArrayKindAdded
konst::polymorphism::IsRefKindAdded
konst::cmp::ConstCmpUnreftraits.Moved all
Is*Kindfield-less structs tokonst::polymorphism::kinds, made them all 0-variant enums, and reexported the relevant items inkonst::cmpandkonst::iter.Removed
ConstCmp::Thisassociated type, now it's derived withConstCmpUnref.Added
konst::slice::BytesPatterntrait, implemented forchar,[u8],[u8; N], andstr.Made the second parameter of
konst::slice::bytes_*functions take a genericBytesPattern.Added
konst::string::Patterntrait, implemented forcharand&strMade
stringfunctions takeP: Pattern<'s>as the pattern argument.Bumped minimum supported Rust versions to 1.65.0
Added
const_panic = "0.2"depdendency tokonstMade all panicking code use
const_panicto have the same error messages as at runtime (previously use array indexing hack to panic).Added
konst::array::from_fnmacro.Added
konst::iter::{repeat, Repeat}.Added iteration over ranges of non-usize integers and
char.Added
konst::iter::Steptrait.Added
konst::ffi::cstrmodule.Reexporting
konst::iter::step::Stepinkonst::iterAdded these
konst::stringitems:Chars(struct)RChars(struct)CharIndices(struct)RCharIndices(struct)char_indices(function)chars(function)from_iter(macro)is_char_boundary(function)str_concat(macro)str_join(macro)
Rewrote
Parserto only support parsing&str.Added
Parser::{skip, skip_back}methodsRemoved these parser functions:
Parser::*_bParser::*_u8(except forparse_u8)Parser::advance_*Parser::from_bytes
Renamed these
Parserfunctions:from_strtonew.bytestoremainder(and takes&str)
Added these
Parsermethods:into_other_errorrsplit_terminatorrsplitsplit_keepsplit_terminatorsplitskipskip_backtrimtrim_matcheswith_start_offset
Added
ParseError::other_errorfunction for constructingOthererrors with custom error messages.Added
FromBothvariant tokonst::parser::ParseDirectionRenamed
ParserFortrait toHasParserAdded
SplitExhausted,DelimiterNotFoundvariants tokonst::parsing::ErrorKindRemoved
map_errcapability oftry_rebinddue to being untested and unused.Removed
unwrap_opt_orandunwrap_res_ormacros (they are superceeded by other macros).Made
array::mapand iterator-taking macros support specifying an explicit return type.Added
assertc_eq,assertc_nemacros.Added type annotation support to
rebind_if_okmacro (for the pattern as a whole).Fixed support for
continueandbreakinside ofkonst::for_range.Changed
Parsermethods from taking&strpatterns to taking anyP: Pattern<'p>Renamed
parse_anymacro toparser_methodRemoved
konst::primitive::parse_*_bfunctionsRenamed
"parsing"feature to"parsing_proc"and"parsing_no_proc"feature to"parsing"Added
"iter"feature(enabled by default), feature-gating all iterator-related items.Added
"debug"feature for additional safety checks inkonstunsafe code.Made
konstcrate 2021 edition,resolver="2".Removed all
"rust_1_*"features, and all old-version-dependent code.Renamed
konst_macro_rulestokonst_kernelcrate, which defines items for reexporting inkonst(mostly needed for having macros in submodules).0.2
-
0.2.2016 Apr 2026Release notes
Open source →Fixed compilation error in
konst::ptrmodule on Rust nightly 2026-04-09. -
0.2.1909 Oct 2022Release notes
Open source →Addeded
konst::itermodule, with const encodings ofIteratorAPI: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_once
Added these const string iterators (enabled by the
"rust_1_64"feature):konst::string::Splitkonst::string::RSplitkonst::string::SplitTerminatorkonst::string::RSplitTerminator
Added 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::RangeFromIter
Added
konst::option::copiedfunction (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. -
0.2.1818 Sep 2022Nothing published for this version
-
0.2.1718 Sep 2022Nothing published for this version
-
0.2.1618 Sep 2022Release notes
Open source →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. -
0.2.1505 Jul 2022Nothing published for this version
-
0.2.1405 Jul 2022Release notes
Open source →Made
"deref_raw_in_fn"feature only require Rust 1.56.0 by stopping the use of an (already stabilized) nightly feature flag. -
0.2.1318 Sep 2021Release notes
Open source →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
MaybeUninitfunctions: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/
NonNullfunctins: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)
-
0.2.1214 Sep 2021 -
0.2.1111 Sep 2021Nothing published for this version
-
0.2.1020 Aug 2021Release notes
Open source →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::get
Added 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_keep
Renamed these functions, reexported with old name, and deprecated the reexport:
string::str_starts_with: renamed tostring::starts_withstring::str_ends_with: renamed tostring::ends_withstring::str_find: renamed tostring::findstring::str_contains: renamed tostring::containsstring::str_rfind: renamed tostring::rfindstring::str_rcontains: renamed tostring::rcontains
Added the
konst::string::from_utf8macro.Added
konst::string::Utf8Errorerror struct. -
0.2.915 Aug 2021 -
0.2.813 Aug 2021Nothing published for this version
-
0.2.713 Aug 2021Release notes
Open source →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_mut
-
0.2.601 Aug 2021Nothing published for this version
-
0.2.530 Jul 2021Release notes
Open source →Added
ParseFortrait andparse_withmacro, for type-dispatched parsing.Added
StdParserstruct as the parser for std types.Broadened valid syntax for try_rebind/rebind_if_ok
Added trailing comma support to every macros, where applicable
-
0.2.431 Mar 2021Release notes
Open source →Fixed handling of length argument of
slice::try_into_arraymacro, when the "const_generics" feature is enabled, it would previously require non-trivial expressions to be wrapped in braces. -
0.2.330 Mar 2021Release notes
Open source →Added the
slice::try_into_arraymacro and nightly function to try to convert&[T]to&[T; N]Defined the
slice::TryIntoArrayErroras the error type forslice::try_into_arrayAdded
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-Copytypes:option::NONE: alias forNonealloc_type::COW_STR_NEW: An emptyCow<'_, str<alloc_type::COW_SLICE_NEW: An emptyCow<'_, [T]>alloc_type::STRING_NEW: An emptyStringalloc_type::VEC_NEW}: An emptyVec<T>maybe_uninit::UNINIT: An uninitMaybeUninit<T>maybe_uninit::UNINIT_ARRAY: An uninit[MaybeUninit<T>; LEN]
Added
"deref_raw_in_fn"feature to enableconst fns that need to dereference raw pointers, requires the nightly compiler.Added
"alloc"feature to enable thealloc_typemodule. -
0.2.227 Mar 2021Nothing published for this version
-
0.2.127 Mar 2021Release notes
Open source →Defined the
konst_macro_rulescrate 0.2.0, to reexport macros inkonstsubmodules.Added macro equivalents of
Option::{and_then, filter, map, ok_or, ok_or_else, or_else, unwrap_or, unwrap_or_else, flatten}in thekonst::optionmodule.Added macro equivalents of
Result::{unwrap_ctx, unwrap_or, unwrap_or_else, ok, err, map, map_err, and_then, or_else}in thekonst::resultmodule.Deprecated the
unwrap_opt_or, andunwrap_res_ormacros.Defined
result::unwrap_err_or_elsemacro for convenience.Added
try_andtry_optmacrosAdded
primitive::parse_*functions, to parse all integer types and bool from&stror&[u8].Added
Parser::parse_methods for the remaining integer types (u8,u16,u32,i8,i16,i32)Added "parsing_no_proc" cargo feature, to enable all parser items except for those that require using the
konst_proc_macrocrate.Fixed
eq_bytesandcmp_bytesdoc examplesFixed the lack of indicators that the
rebind_if_okandtry_rebindmacros require the"parsing_no_proc"feature. -
0.2.023 Mar 2021Release notes
Open source →Breaking change: tightened the syntax of the
parse_anymacro, now it requires the last branch in the match-like syntax to be_ => <expression>, forbidding_patterns in other branches.Added support for these
Parsermethods inparse_any:find_skip-rfind_skip-trim_start_matches-trim_end_matches
Moved these functions from
slice::cmptoslice, and reexported back inslice::cmp:cmp_slice_u8: renamed tocmp_byteseq_slice_u8: renamed toeq_bytescmp_option_slice_u8: renamed tocmp_option_byteseq_option_slice_u8: renamed toeq_option_bytesThe above*_bytesfunctions do not require any cargo features to use.
Added comparison functions for
&[usize],&[isize],Option<&[usize]>,Option<&[isize]>0.1
-
0.1.122 Mar 2021Nothing published for this version
-
0.1.022 Mar 2021Release notes
Open source →Defined the
konst_proc_macroscrate 0.1.0, for internal use bykonst.Defined equality and ordering comparison functions for:
-
All the primitive types, including integers, bool, char, and
Options of them, inside theprimitives::cmpmodule. -
Ranges andRangeInclusives of all unsigned integer types, inside therange::cmpmodule. -
All the
NonZero*types, andOption<NonZero*>types, inside thenonzero::cmpmodule. -
&strandOption<&str>, inside thestringmodule. -
Ordering,Option<Ordering>,PhantomData<T>,PhantomPinned, inside theother::cmpmodule. -
Slices of integers,
&[bool],&[char],&[&str],&[&[u8]], andOptions of them, inside theslice::cmpmodule.
Defined the polymorphism module, to do type-based overloading, currently limited to
const_eqandconst_cmpmethods.Defined these items in the
polymorphismmodule:-
CmpWrapper: Wrapper type which implements many methods for std types, currently onlyconst_eqandconst_cmp. -
ConstCmpMarker: Trait for describing whether a type is from the standard library, and has
const_eqand/orconst_cmpmethods. -
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
slicemodule: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
stringmodule:str_contains,str_ends_with,str_find,str_rcontains,str_rfind,str_starts_withDeclared the
parsingmodule with:-
Parser: A parser constructible from&[u8]or&str. -
ParseError: The error type returned by fallibleParsermethods. -
ErrorKind: Enum for the kinds of parsing errors that happened, included insideParseError -
ParseDirection: Enum for the direction a parser is currently parsing from, either the end or the start. -
ParseValueResult: Type alias for theResulttypes thatParserreturns when parsing types. -
ParserResult: Type alias forResult<'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 withconst_eqorconst_cmpmethods. -
const_cmp,const_cmp_for,const_eq,const_eq_for: for comparing values -
for_range: for iterating over a range. -
impl_cmp: For implementingConstCmpMarkerfor multiple types, and declaringconst_eq/const_cmp. -
konst: For emulating inline const (const{ }). -
parse_any: For callingParsermethods with multiple alternative string literal patterns. -
rebind_if_ok:if let Okwhich rebinds variables instead of shadowing them. -
try_equal: For returning early when an ordering isn'tOrdering::Equal -
try_rebind: For returning early onErr, rebinding variables onOk. -
unwrap_ctx: Unwraps aResult, calling.panic()on the error value on error. -
unwrap_opt_or: Const-equivalent ofOption::unwrap_orandOption::unwrap_or_else. -
unwrap_res_or: Const-equivalent ofResult::unwrap_orandResult::unwrap_or_else.
Defined these cargo features:
-
"cmp"(enabled by default): Enables all the comparison functions and macros. -
"parsing"(enabled by default): Enables theparsingmodule, macros, and compiles thekonst_proc_macroscrate. -
"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 .
-
-
0.0.015 Mar 2021 withdrawnNothing published for this version