- Update documentation.
- Error types now implement
core::error::Error
, which was stabilised in Rust 1.81. Encode
andDecode
are implemented forcore::num::{NonZeroIsize, NonZeroUsize}
(see merge request 48 by @chrysn).
- Maintenance release (documentation tweaks).
- Maintenance release (cf. merge request 47 by @chrysn).
- Maintenance release (cf. merge request 46 by @deundiak).
- Added
minicbor::data::Tagged
, a newtype with a statically attached numeric tag. - Added attributes
skip
andtag
(see minicbor-derive-0.15.0 for details). - Depend on
minicbor-derive-0.15.0
.
- Moved
Token
fromminicbor::decode
tominicbor::data
.Token
also implementsDecode
now. - Removed the deprecated
Encoder::into_inner
method. UseEncoder::into_writer
instead.
⚠️ Breaking⚠️ :Tokenizer
now has two lifetime parameters because it sometimes borrows the innerDecoder
.Token
s can now also be encoded (cf. merge request 37 by @alistair23). MethodsEncoder::tokens
andDecoder::tokens
have been added.
Tag::new
andTag::as_u64
are now declaredconst
(cf. merge request 36 by @DCNick3).
⚠️ Breaking⚠️ : Tag handling has been reworked (cf. merge request 34). TheTag
type is now merely a newtype around au64
. A new enumIanaTag
represents registered tag values.
- Support for decoding arrays of arbitrary length has been added (cf. merge request 31 by @samuelmhicks).
- Added
Encode
andDecode
impls forCStr
andCString
(cf. merge request 29). - Added
decode::info::Size
to allow length introspection of CBOR values (see merge requests 25 and 28 for details).
- Bugfix release (see merge request 26 by @jeandudey for details).
- Added the trait
CborLen
and functionsminicbor::len
andminicbor::len_with
to allow client code to calculate the length in bytes of a value's CBOR representation. See issue 32 and merge request 23 for details.
- Remove feature
partial-derive-support
.Encode
andDecode
can always be derived. See commits 21060b3272d4d09af88aa8543f682c8c4477a886 and 9038d3cced197588ae4d8d2c891d6f51029a9e7d for details. - Rework
encode::Write
impls. The blanket impl for types implementingstd::io::Write
has been removed. The impl forVec<u8>
now always usesInfallible
as 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
.
- Fix missing import for cargo feature
derive
.
- Remove cargo feature
partial-skip-support
. The methodDecoder::skip
is 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
.
- Specialise
Cow<_, [u8]>
by adding implementations ofminicbor::bytes::{EncodeBytes, DecodeBytes}
.
- No change since
0.16.0-rc.1
.
-
⚠️ Breaking⚠️ : TheEncode
andDecode
traits are now parameterised by a context type and the context value is passed as another argument toEncode::encode
andDecode::decode
(see merge request 21 and issue 26 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 typedata::Cbor
has been removed. To write pre-existing CBOR bytes useEncoder::writer_mut
withWrite::write_all
and to access raw CBOR bytes from the decoder useDecoder::input
. -
⚠️ Breaking⚠️ : TheAsRef
impl forEncoder
has been removed. UseEncoder::writer
instead. -
⚠️ Breaking⚠️ : The legacy module and feature flag have been removed. -
Decoder::input
has 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
Decoder
andEncoder
to work with contexts:Decoder::decode_with
Decoder::array_iter_with
Decoder::map_iter_with
Encoder::encode_with
These correspond to the existing variants without the
_with
suffix which do not accept a context and fix the context type to()
. Note that generic implementations ofDecode
andEncoder
must therefore use the versions which accept a context parameter.Other additions include the crate-level functions:
encode_with
decode_with
to_vec_with
-
⚠️ 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::legacy
is 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::Int
has been introduced (see merge request 20) to allow encoding and decoding of the whole CBOR integer range [-264, 264 - 1]. -
⚠️ Breaking⚠️ : As a consequence of adding the newInt
type, a new constructorminicbor::data::Type::Int
has been added to denote those (signed) integers that do not fit into ani64
. Similarly the new constructorminicbor::decode::Token::Int
captures those values.
- Bugfix release: Imports
alloc::string::ToString
when necessary (see issue 21) for details.
- Maintenance release: Add position information to UTF-8 decoding errors.
⚠️ Breaking⚠️ :encode::Error
anddecode::Error
are 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.
- Added
Decode
impl forBox<str>
(see merge request 18 by @tailhook).
- Bugfix:
Decoder::datatype
would sometimes report incorrect types for negative integers (see issue 18 and commit 0bd97b72 for details).
⚠️ Breaking⚠️ : Removed theClone
impl ofdecode::Error
.- Added a new variant
decode::Error::Custom
(requires featurestd
) which contains an arbitraryBox<dyn std::error::Error + Send + Sync>
.
- Change
Tokenizer::token
to 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::token
may not terminate.
- Extend the optionality of fields beyond
Option
. This applies to derived impls ofEncode
andDecode
which make use of newly added methodsEncode::is_nil
andDecode::nil
instead ofOption::is_none
andNone
. See issue 10 and merge request 15 for details.
- Accept non-preferred integer encodings (see issue 14 for details).
- Added
Decoder::{null, undefined}
methods. - Added
data::Cbor
as identity element ofEncode
andDecode
.
- Bugfix: Decoding strings or bytes with a length of
u64::MAX
would cause an overflow of the internal decoder position value. This case is now properly handled. See issue 12 for details. - Bugfix: The
partial-derive-support
feature did not re-exportminicbor-derive
, nor did it make the functionality ofminicbor::bytes
available. See merge request 14 by @dne1 for details.
- Bugfix release: Version
0.11.2
addedEncode
/Decode
impls for various atomic types without considering their availability on the target platform (cf. issue 11). In here we attempt to only offer impls for available atomic types (cf. merge request 13 for details).
- Improves
minicbor::display
to be more robust when applied to malformed CBOR values (see commit c1294dd for details). - Adds several
Encode
/Decode
impls:core::num::Wrapping
core::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
- Depends on
minicbor-derive-0.7.1
.
- Depends on
minicbor-derive-0.7.0
.
- Small bugfix release (see commit 68963dc for details).
⚠️ Breaking⚠️ : By defaultDecoder::skip
is 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 and issue 9.
- Adds a few more trait impls to
ByteArray
andByteVec
. See commit b17fe67.
⚠️ Breaking⚠️ : The encoding of()
andPhantomData
has changed. See commit b6b1f907.⚠️ Breaking⚠️ : Thedecode::Error::TypeMismatch
constructor changed to use adata::Type
instead of au8
as its first parameter. See merge request 6 for details.- Added feature flag
alloc
(implied bystd
), which enables most collections types in ano_std
environment. See merge request 9 for details. - Added
ByteArray
to support compact encoding ofu8
-arrays, similarly to the already existingByteSlice
andByteVec
types added inminicbor-0.6.0
. See merge request 10 for details. - Added
Write
impl foralloc::vec::Vec
(see merge request 11 by @Hawk777). - Depends on
minicbor-derive-0.6.4
.
- Depends on
minicbor-derive-0.6.3
.
⚠️ Breaking⚠️ : Changedata::Type
to distinguish between indefinite arrays, maps, bytes and strings, and regular ones by introducing constructors such asType::ArrayIndef
.- Add new types
decode::Token
anddecode::Tokenizer
to allow decoding CBOR bytes generically as a mere sequence of tokens. - Add a function
display
which displays CBOR bytes in diagnostic notation.
- Bugfix:
Type::read
used0xc9
instead of0xc0
when readingType::Tag
. - Add README.md
- Require
minicbor-derive-0.6.1
.
- Require
minicbor-derive-0.6.0
.
- Removes the
&[u8]
impl forDecode
(see issue 4) and add a new moduleminicbor::bytes
to support specialised encoding of CBOR bytes. This module provides the typesByteSlice
andByteVec
which are substitutes for&[u8]
andVec<u8>
respectively. See also the module documentation ofminicbor::bytes
.
- Require
minicbor-derive-0.4.1
.
- Require
minicbor-derive-0.4.0
.
- Adds
Encoder::f16
to support encoding off32
values as half floats. Complements the existingDecoder::f16
method and depends on the featurehalf
.
- Added
Encode
andDecode
impls for tuples (see merge request 1 by @koushiro).
- Update documentation.
- Maintenance release (documentation tweaks).
- Maintenance release (documentation tweaks).
- Added attribute
skip
for fields, which ignores the value during encoding and initialises it withDefault::default()
during decoding. - Added attribute
tag
to allow specifying the tag value which the subsequent value is encoded and decoded with. - Requires
minicbor-0.24.0
.
- Upgrade dependency
syn
to version 2.0 (cf. commit 3a63fc304d380f2477959906a54b1f3dedc8ccef for details). - Requires
minicbor-0.22.0
.
- Added the ability to derive the
CborLen
trait on structs and enums. - Requires
minicbor-0.19.0
.
- Add features "alloc" and "std" to import the correct
Cow
depending on feature use. (See commit 21060b3272d4d09af88aa8543f682c8c4477a886 for details.) - Clarify what ignoring fields means and how it relates to the "alloc" feature. (See commit 9038d3cced197588ae4d8d2c891d6f51029a9e7d for details.)
- Improve
#[cbor(transparent)]
: Previously, custom encode/decode functions where not allowed, preventing the use ofwith = "minicbor::bytes
. Explicit borrowing fromCow
s did also not work, creating ownedCow
values instead.
- Update documentation due to changes in
minicbor-0.16.1
.
- Small documentation update.
- Depends on
minicbor-0.16.0-rc.1
. - A new attribute
context_bound
has been added to allow constraining the generic context type of the derivedEncode
orDecode
trait impl with a set of trait bounds.
- Requires
minicbor-0.14.0
.
- Uses
Encode::is_nil
andDecode::nil
instead ofOption::is_none
andNone
to generalise field optionality. - Adds new attributes
is_nil
,nil
andhas_nil
to enable integration of optional types which do not implementEncode
orDecode
.
- Small bugfix release.
- Small error reporting improvement (cf. 1b1cb41).
- Major internal refactoring to make attribute parsing more flexible and robust.
- Adds as new attributes
encode_bound
,decode_bound
andbound
to allow overriding the generated type parameter bounds.
- Improve hygiene (see merge request 7).
- Improve macro hygiene.
- Add README.md
- Maintenance release.
- Adds
#[cbor(index_only)]
attribute to support a more compact encoding for enums without fields (read the documentation for details).
- When deriving, the attribute
#[cbor(with = "minicbor::bytes")]
can be used for&[u8]
andOption<&[u8]>
if direct use ofByteSlice
is not desired. See also the section "What about&[u8]
?" inminicbor-derive
.
- Adds
#[cbor(transparent)]
to allow newtypes to use the same CBOR encoding as their inner type.
- Adds
#[cbor(encode_with)]
,#[cbor(decode_with)
and#[cbor(with)]
attributes to allow custom encode/decode functions which replace their trait counterparts or provide a way to handle types which do not implement these traits.
- Added
#[cbor(map)]
and#[cbor(array)]
attributes (see commit 40e8b240 for details).
- Update documentation.
- Error types now implement
core::error::Error
, which was stabilised in Rust 1.81. - Requires
minicbor-0.25.0
.
- Maintenance release (documentation tweaks).
- Require
minicbor-0.24.0
.
- Require
minicbor-0.23.0
.
- Require
minicbor-0.22.0
.
- Maintenance release.
- Require at least
minicbor-0.21.1
.
- Require at least
minicbor-0.21.0
.
- Require at least
minicbor-0.20.0
.
- Require at least
minicbor-0.19.0
.
- Depend on
minicbor-0.18.0
. minicbor_io::Error::Encode
now contains aminicbor::encode::Error<Infallible>
. (See commit 498043ddce69e3da0dcc66593afdeea0dd058fb8 for details.)
- Depend on
minicbor-0.17.0
.
- No change since
0.11.0-rc.1
.
-
Depends on
minicbor-0.16.0-rc.1
. -
The following new methods have been added:
Reader::read_with
AsyncReader::read_with
Writer::write_with
AsyncWriter::write_with
These accept an additional context parameter and the existing variants fix the context to the unit type.
- Depends on
minicbor-0.15.0
.
- Depends on
minicbor-0.14.0
.
- Depends on
minicbor-0.13.0
.
- Depends on
minicbor-0.12.0
.
- Depends on
minicbor-0.11.0
.
- Depends on
minicbor-0.10.0
.
- Depends on
minicbor-0.9.0
.
- Depends on
minicbor-0.8.1
.
- Depends on
minicbor-0.8.0
.
- Add README.md
- Use same version for
minicbor
dependency independencies
anddev-dependencies
.
Reader
andAsyncReader
always returnUnexpectedEof
when reading 0 bytes while decoding a frame, unless at the very beginning of a frame, when not even the length prefix has been read, whereOk(None)
would be returned instead. Previous versions returnedOk(None)
while reading a partial length prefix.
- Update dev-dependencies.
- Fix link to documentation in
Cargo.toml
.
- Initial release which provides some I/O utilities.
- Add
no_std
attribute (see issue #3).
- Update documentation.
- Error types now implement
core::error::Error
, which was stabilised in Rust 1.81. Deserializer::from_slice
has been renamed toDeserializer::new
andto_vec
is available with featurealloc
.- Requires
minicbor-0.25.0
.
- Exports error module.
- Maintenance release (documentation tweaks).
- Initial release.