minicbor
A small CBOR codec suitable for no_std environments.
2.3.0
13M downloads/mo
#2673 most downloaded on crates.io
twittner/minicbor
What this package is like to depend on
Last release 1 months ago
23 Jul 2026
Ships fairly regularly
a new release about every 4 weeks
Nearly every release is documented
notes for 70 of 70 stable releases
Nothing withdrawn
no release was ever pulled
6 years old
71 releases · first in 2020
7 releases in the last 12 months
see the full history below
Release timeline
71 releases · Mar 2020 to Jul 2026Releases
latest 60 of 71-
2.3.023 Jul 2026Release notes
Open source →- Adds support for
u128/i128. See pull request [63][pr63] by @sdbondi for details.
- Adds support for
-
2.2.320 Jul 2026Release notes
Open source →- The
stdfeature is no longer required for:IpAddr,Ipv4Addr,Ipv6Addr,SocketAddr,SocketAddrV4,SocketAddrV6.
- Depends on
minicbor-derive-0.19.5.
- The
-
2.2.217 May 2026Release notes
Open source →- Fixes bugs related to
CborLencalculation, see commit cb19b238e5245729932a9cf9611818be1dc20ab6 for details. - Depends on
minicbor-derive-0.19.4.
- Fixes bugs related to
-
2.2.124 Feb 2026 -
2.2.001 Feb 2026 -
2.1.324 Nov 2025 -
2.1.221 Nov 2025Release notes
Open source →- Replaces
build.rswithtarget_has_atomic. See pull request [47][pr47] by @dtolnay for details.
- Replaces
-
2.1.123 Aug 2025 -
2.1.016 Aug 2025Release notes
Open source →- Added
Encoder::str_len, mirroringEncoder::bytes_lenwhich was added in 0.26.1. - Depends on
minicbor-derive-0.18.1.
- Added
-
2.0.023 Jul 2025Release notes
Open source →-
Depends on
minicbor-derive-0.18.0(see below). -
⚠️ Breaking ⚠️ Several generic implementations of
EncodeandDecodedid not override the defaultis_nilandnilmethods. As a result, if a typeTimplementsEncodeandDecodewith implementations ofis_nilandnil, wrapping the type in aBoxorCellor encoding it via reference would revert to the default implementation. This has been fixed and the following impls now override the defaults:&T&mut TBox<T>Cow<'_, T>Cell<T>RefCell<T>
With this fix, these types have a nil value if
Thas one whereas prior versions would not. -
The
Encodeimplementation ofRefCellno longer usestry_borrow, butborrow.
-
-
1.1.022 Jul 2025Release notes
Open source →- Adds
encode::Error::{as_write, into_write}to allow easier access to an error caused by aWriteimplementation.
- Adds
-
1.0.018 May 2025 -
0.26.527 Apr 2025 -
0.26.412 Apr 2025Release notes
Open source →- Implementations of
Iterator::size_hintfordecode::{ArrayIter, ArrayIterWithCtx},decode::{MapIter, MapIterWithCtx}anddecode::{BytesIter, StrIter}` (see pull request [27][pr27] by @carloskiki for details). - Fixes an issue with
decode::{BytesIter, StrIter}, both of which would yieldNonefor definite but empty bytes or text. They now yieldSome(&[])orSome("")respectively. Note that the behaviour for non-empty definite bytes or text values and for indefinite ones does not change. - Implements
EncodeBytes,DecodeBytesandCborLenBytesforBox<[u8]>(see pull request [28][pr28] by @carloskiki for details).
- Implementations of
-
0.26.320 Mar 2025 -
0.26.216 Mar 2025Release notes
Open source →- Fixes issue with
minicbor::display(see issue [25][i25]) for details. - Depends on
minicbor-derive-0.16.1.
- Fixes issue with
-
0.26.101 Mar 2025Release notes
Open source →- The method
Encoder::bytes_lenhas been added. LikeEncoder::bytes, it writes the CBOR item head of a byte string. However, unlikeEncoder::bytes, it does not require the actual bytes as a parameter, leaving their encoding to the application. This mirrors the approach ofEncoder::arrayandEncoder::map, which also encode only the CBOR item head, with applications encoding the elements via subsequent encoder method calls. For further details, see pull request [16][pr16] by @carloskiki. EncodeandDecodeimpls forusize,isize,NonZeroUsizeandNonZeroIsizeon 16-bit architectures have been added by @chrysn. See pull request [19][pr19] for details.
- The method
-
0.26.018 Feb 2025 -
0.25.112 Sep 2024 -
0.25.010 Sep 2024Release notes
Open source →- Error types now implement
core::error::Error, which was stabilised in Rust 1.81. EncodeandDecodeare implemented forcore::num::{NonZeroIsize, NonZeroUsize}(see merge request [48][mr48] by @chrysn).
- Error types now implement
-
0.24.404 Sep 2024 -
0.24.303 Sep 2024 -
0.24.228 Jun 2024 -
0.24.118 Jun 2024Release notes
Open source →- Maintenance release (cf. merge requests [44][mr44] by @alistair23 and [45][mr45] by @deundiak).
-
0.24.017 Apr 2024Release notes
Open source →- Added
minicbor::data::Tagged, a newtype with a statically attached numeric tag. - Added attributes
skipandtag(see minicbor-derive-0.15.0 for details). - Depend on
minicbor-derive-0.15.0.
- Added
-
0.23.010 Apr 2024Release notes
Open source →- Moved
Tokenfromminicbor::decodetominicbor::data.Tokenalso implementsDecodenow. - Removed the deprecated
Encoder::into_innermethod. UseEncoder::into_writerinstead.
- Moved
-
0.22.009 Apr 2024Release notes
Open source →- ⚠️ Breaking ⚠️:
Tokenizernow has two lifetime parameters because it sometimes borrows the innerDecoder. Tokens can now also be encoded (cf. merge request [37][mr37] by @alistair23). MethodsEncoder::tokensandDecoder::tokenshave been added.
- ⚠️ Breaking ⚠️:
-
0.21.128 Mar 2024Release notes
Open source →Tag::newandTag::as_u64are now declaredconst(cf. merge request [36][mr36] by @DCNick3).
-
0.21.028 Feb 2024Release notes
Open source →- ⚠️ Breaking ⚠️: Tag handling has been reworked (cf. merge request [34][mr34]). The
Tagtype is now merely a newtype around au64. A new enumIanaTagrepresents registered tag values.
- ⚠️ Breaking ⚠️: Tag handling has been reworked (cf. merge request [34][mr34]). The
-
0.20.024 Sep 2023Release notes
Open source →- Support for decoding arrays of arbitrary length has been added (cf. merge request [31][mr31] by @samuelmhicks).
- Added
EncodeandDecodeimpls forCStrandCString(cf. merge request [29][mr29]). - Added
decode::info::Sizeto allow length introspection of CBOR values (see merge requests [25][mr25] and [28][mr28] for details).
-
0.19.110 Mar 2023Release notes
Open source →- Bugfix release (see merge request [26][mr26] by @jeandudey for details).
-
0.19.017 Dec 2022Release notes
Open source →- Added the trait
CborLenand functionsminicbor::lenandminicbor::len_withto allow client code to calculate the length in bytes of a value's CBOR representation. See issue [32][i32] and merge request [23][mr23] for details.
- Added the trait
-
0.18.019 Jun 2022Release notes
Open source →- Remove feature
partial-derive-support.EncodeandDecodecan always be derived. See commits 21060b3272d4d09af88aa8543f682c8c4477a886 and 9038d3cced197588ae4d8d2c891d6f51029a9e7d for details. - Rework
encode::Writeimpls. The blanket impl for types implementingstd::io::Writehas been removed. The impl forVec<u8>now always usesInfallibleas its error type andminicbor::{to_vec, to_vec_with}no longer require feature "std". See commit 498043ddce69e3da0dcc66593afdeea0dd058fb8 for details. - Depend on
minicbor-derive-0.12.0.
- Remove feature
-
0.17.101 Jun 2022 -
0.17.001 Jun 2022Release notes
Open source →- Remove cargo feature
partial-skip-support. The methodDecoder::skipis now always available. With cargo featurealloc, every CBOR item can be skipped over, otherwise attempting to skip over indefinite-length arrays or maps inside of regular arrays or maps will result in an error. - Depend on
minicbor-derive-0.11.0.
- Remove cargo feature
-
0.16.127 May 2022Release notes
Open source →- Specialise
Cow<_, [u8]>by adding implementations ofminicbor::bytes::{EncodeBytes, DecodeBytes}.
- Specialise
-
0.16.008 May 2022 -
0.16.0-rc.101 May 2022 pre-releaseRelease notes
Open source →-
⚠️ Breaking ⚠️: The
EncodeandDecodetraits are now parameterised by a context type and the context value is passed as another argument toEncode::encodeandDecode::decode(see merge request [21][mr21] and issue [26][i26] for details). Implementations of these traits that do not make use of the context need to be generic in the type variable and accept the context parameter, e.g. instead ofstruct T; impl Encode for T { fn encode<W: Write>(&self, e: &mut Encoder<W>) -> Result<(), Error<W::Error>> { ... } } impl<'b> Decode<'b> for T { fn decode(d: &mut Decoder<'b>) -> Result<Self, Error> { ... } }one would now write:
struct T; impl<C> Encode<C> for T { fn encode<W: Write>(&self, e: &mut Encoder<W>, ctx: &mut C) -> Result<(), Error<W::Error>> { ... } } impl<'b, C> Decode<'b, C> for T { fn decode(d: &mut Decoder<'b>, ctx: &mut C) -> Result<Self, Error> { ... } } -
⚠️ Breaking ⚠️: The type
data::Cborhas been removed. To write pre-existing CBOR bytes useEncoder::writer_mutwithWrite::write_alland to access raw CBOR bytes from the decoder useDecoder::input. -
⚠️ Breaking ⚠️: The
AsRefimpl forEncoderhas been removed. UseEncoder::writerinstead. -
⚠️ Breaking ⚠️: The legacy module and feature flag have been removed.
-
Decoder::inputhas been added to get a reference to the input bytes. -
The newtypes
minicbor::encode::{ArrayIter, MapIter}have been added to encode any clonable iterator as a CBOR array or map. -
Several new methods have been added to
DecoderandEncoderto work with contexts:Decoder::decode_withDecoder::array_iter_withDecoder::map_iter_withEncoder::encode_with
These correspond to the existing variants without the
_withsuffix which do not accept a context and fix the context type to(). Note that generic implementations ofDecodeandEncodermust therefore use the versions which accept a context parameter.Other additions include the crate-level functions:
encode_withdecode_withto_vec_with
-
-
0.15.013 Mar 2022Release notes
Open source →-
⚠️ Breaking ⚠️: The encoding of IP addresses changed (see commit fac39d5a). This affects the following types:
- std::net::IpAddr
- std::net::Ipv4Addr
- std::net::Ipv6Addr
- std::net::SocketAddr
- std::net::SocketAddrV4
- std::net::SocketAddrV6
A new module
minicbor::legacyis introduced which contains newtype wrappers for these types which continue to use the array-based encoding. Users can opt out of the new compact format by enabling the cargo feature"legacy"and importing the types from the legacy module. -
A new type
minicbor::data::Inthas been introduced (see merge request [20][mr20]) to allow encoding and decoding of the whole CBOR integer range [-2<sup>64</sup>, 2<sup>64</sup> - 1]. -
⚠️ Breaking ⚠️: As a consequence of adding the new
Inttype, a new constructorminicbor::data::Type::Inthas been added to denote those (signed) integers that do not fit into ani64. Similarly the new constructorminicbor::decode::Token::Intcaptures those values.
-
-
0.14.212 Mar 2022Release notes
Open source →- Bugfix release: Imports
alloc::string::ToStringwhen necessary (see issue [21][i21]) for details.
- Bugfix release: Imports
-
0.14.127 Feb 2022 -
0.14.020 Feb 2022Release notes
Open source →- ⚠️ Breaking ⚠️:
encode::Erroranddecode::Errorare now structs instead of enums. The actual error representation is hidden and errors are constructed with functions instead of creating enum values directly, for exampleError::Message("foo")is nowError::message("foo"). This was done to support adding more information to error values, like the decoding position. For details see merge request [19][mr19].
- ⚠️ Breaking ⚠️:
-
0.13.206 Feb 2022Release notes
Open source →- Added
Decodeimpl forBox<str>(see merge request [18][mr18] by @tailhook).
- Added
-
0.13.103 Feb 2022Release notes
Open source →- Bugfix:
Decoder::datatypewould sometimes report incorrect types for negative integers (see issue [18][i18] and commit 0bd97b72 for details).
- Bugfix:
-
0.13.030 Jan 2022Release notes
Open source →- ⚠️ Breaking ⚠️: Removed the
Cloneimpl ofdecode::Error. - Added a new variant
decode::Error::Custom(requires featurestd) which contains an arbitraryBox<dyn std::error::Error + Send + Sync>.
- ⚠️ Breaking ⚠️: Removed the
-
0.12.102 Jan 2022Release notes
Open source →- Change
Tokenizer::tokento move to the end of decoding input when an error occurs. This is done because some errors do not cause consumption of the input, hence repeated calls toTokenizer::tokenmay not terminate.
- Change
-
0.12.029 Nov 2021Release notes
Open source →- Extend the optionality of fields beyond
Option. This applies to derived impls ofEncodeandDecodewhich make use of newly added methodsEncode::is_nilandDecode::nilinstead ofOption::is_noneandNone. See issue [10][i10] and merge request [15][mr15] for details.
- Extend the optionality of fields beyond
-
0.11.521 Nov 2021Release notes
Open source →- Accept non-preferred integer encodings (see issue [14][i14] for details).
- Added
Decoder::{null, undefined}methods. - Added
data::Cboras identity element ofEncodeandDecode.
-
0.11.430 Oct 2021Release notes
Open source →- Bugfix: Decoding strings or bytes with a length of
u64::MAXwould cause an overflow of the internal decoder position value. This case is now properly handled. See issue [12][i12] for details. - Bugfix: The
partial-derive-supportfeature did not re-exportminicbor-derive, nor did it make the functionality ofminicbor::bytesavailable. See merge request [14][mr14] by @dne1 for details.
- Bugfix: Decoding strings or bytes with a length of
-
0.11.324 Sep 2021Release notes
Open source →- Bugfix release: Version
0.11.2addedEncode/Decodeimpls for various atomic types without considering their availability on the target platform (cf. issue [11][i11]). In here we attempt to only offer impls for available atomic types (cf. merge request [13][mr13] for details).
- Bugfix release: Version
-
0.11.219 Sep 2021Release notes
Open source →- Improves
minicbor::displayto be more robust when applied to malformed CBOR values (see commit c1294dd for details). - Adds several
Encode/Decodeimpls:core::num::Wrappingcore::sync::atomic::{AtomicBool, AtomicI8, AtomicI16, AtomicI32, AtomicI64, AtomicIsize}core::sync::atomic::{AtomicU8, AtomicU16, AtomicU32, AtomicU64, AtomicUsize}core::cell::{Cell, RefCell}core::ops::{Bound, Range, RangeFrom, RangeInclusive, RangeTo, RangeToInclusive}std::path::{Path, PathBuf}std::time::SystemTime
- Improves
-
0.11.123 Aug 2021 -
0.11.022 Aug 2021 -
0.10.122 Aug 2021 -
0.10.002 Aug 2021Release notes
Open source →- ⚠️ Breaking ⚠️: By default
Decoder::skipis not available anymore. It can be enabled with feature flag"alloc"(implied by"std") or"partial-skip-support". The latter variant corresponds to the implementation of minicbor <= 0.9.1 but does not support skipping over indefinite-length arrays or maps inside of regular arrays or maps. The variant enabled by"alloc"supports skipping over arbitrary CBOR items. For more information see [feature flags][3] and issue [9][i9].
- ⚠️ Breaking ⚠️: By default
-
0.9.125 Jul 2021Release notes
Open source →- Adds a few more trait impls to
ByteArrayandByteVec. See commit b17fe67.
- Adds a few more trait impls to
-
0.9.021 Jul 2021Release notes
Open source →- ⚠️ Breaking ⚠️: The encoding of
()andPhantomDatahas changed. See commit b6b1f907. - ⚠️ Breaking ⚠️: The
decode::Error::TypeMismatchconstructor changed to use adata::Typeinstead of au8as its first parameter. See merge request [6][mr6] for details. - Added feature flag
alloc(implied bystd), which enables most collections types in ano_stdenvironment. See merge request [9][mr9] for details. - Added
ByteArrayto support compact encoding ofu8-arrays, similarly to the already existingByteSliceandByteVectypes added inminicbor-0.6.0. See merge request [10][mr10] for details. - Added
Writeimpl foralloc::vec::Vec(see merge request [11][mr11] by @Hawk777). - Depends on
minicbor-derive-0.6.4.
- ⚠️ Breaking ⚠️: The encoding of
-
0.8.112 Apr 2021 -
0.8.014 Mar 2021Release notes
Open source →- ⚠️ Breaking ⚠️: Change
data::Typeto distinguish between indefinite arrays, maps, bytes and strings, and regular ones by introducing constructors such asType::ArrayIndef. - Add new types
decode::Tokenanddecode::Tokenizerto allow decoding CBOR bytes generically as a mere sequence of tokens. - Add a function
displaywhich displays CBOR bytes in [diagnostic notation][2].
- ⚠️ Breaking ⚠️: Change
-
0.7.228 Feb 2021Release notes
Open source →- Bugfix:
Type::readused0xc9instead of0xc0when readingType::Tag. - Add README.md
- Bugfix: