Releases: mumbleskates/bilrost
Releases · mumbleskates/bilrost
v0.1012.1
v0.1012.1
Fixes
- Internals macros: Fixed the
empty_state_via_for_overwrite
macro, which was
incompletely implemented and still referenced theDefault
trait.
v0.1012.0
v0.1012.0
Breaking changes
-
This release includes a major overhaul of encoding and decoding traits for
the library.Capability Old trait New trait encoding Message
Message
relaxed decoding (owned) Message
OwnedMessage
distinguished decoding (owned) DistinguishedMessage
DistinguishedOwnedMessage
relaxed decoding (borrowed) (new!) BorrowedMessage<'a>
distinguished decoding (borrowed) (new!) DistinguishedBorrowedMessage<'a>
For very simple usage of the
bilrost
library, this will now probably mean
importing bothMessage
andOwnedMessage
traits to have the desired
functionality in scope. -
The
DistinguishedMessage
andDistinguishedOneof
traits & derives are gone
as well; rather than deriving multiple traits, simply add a
#[bilrost(distinguished)]
attribute to the type being derived from:Old derives New derives Message
,DistinguishedMessage
Message
with#[bilrost(distinguished)]
on the structOneof
,DistinguishedOneof
Oneof
with#[bilrost(distinguished)]
on the enumall of the above Message
&Oneof
with#[bilrost(distinguished)]
on the enumjust using Message
,Oneof
, &Enumeration
(no change)
New features
- It is now possible to do borrowed zero-copy decoding, which is enabled by
default and available in the derive macros. This decodes from a&[u8]
slice
with lifetime into messages that may reference its data.- This adds support for the types
&str
,&[u8]
,&[u8; N]
, and
&bstr::BStr
; these types can appear in message fields, oneof fields, and
nested in other containers just like any other type. This also adds
guaranteed behavior forCow
for these borrowed types also decodes as
Cow::Borrowed(&..)
when decoding from borrowed data. - With this addition, there are now two different ways to have zero-copy
decoding that each work slightly differently:- Decode directly from
bytes::Bytes
and into fields of type
bytes::Bytes
orbytestring::Bytestring
. This yields owned, refcounted
handles to the original data. - Decode borrowed from
&[u8]
and into fields of type&str
,&[u8]
,
&[u8; N]
, or&bstr::BStr
. This yields data borrowed for a lifetime at
very low cost, protected by the borrow checker rather than a refcount.
- Decode directly from
- This adds support for the types
- Derive macros are now simpler to use, so now deriving all encoding and
decoding impls for messages and oneofs is done only withMessage
and
Oneof
, and distinguished implementations are switched on and off by
attribute. - Opened the gates for crate documentation in the
encoding
module as the crate
is getting closer to what could become a stable release. - Added
From<Vec<u8>>
andFrom<Box<[u8]>>
impls forReverseBuffer
. - Added new forms of ranges in the
reserved_tags
attribute:5..
and..=5
. - EXPERIMENTAL: Made public a couple macros and the proxying traits &
encoding type; seeencoding::{Proxied, Proxiable}
for details.- These can be used even to encode third-party types foreign to both your own
crate and tobilrost
(via type-tagged impls) and completely break the
guarantees of thebilrost
library. I do my best, but correctness is in
your hands!
- These can be used even to encode third-party types foreign to both your own
Fixes
- Internals: It should no longer be possible for restricted and canonical
message decoding modes to return data or canonicity that is less than the
restriction level that was specified, if a decoding implementation returns a
lower canonicity but forgets to check against the restriction in the context.
The worst that should happen is that the error is raised late, at the end of
decoding, when it is too late to add information about the location of the
error. There are also debug-only assertions that test that this should never
happen, and explanatory documentation about exactly when aCanonicity
should
be checked against the restricted context onRestrictedDecodeContext::check
.- It's unlikely this should change any behavior as formerly the canonicity was
checked very aggressively in all existing implementations, far more often
than it had to be.
- It's unlikely this should change any behavior as formerly the canonicity was
Cleanups
- Changed internal and external phrasing from "expedient" encoding to "relaxed".
- More reorganization and file cleanups, splitting up some large files into more
modules etc. - Cleaned up some docs in the
encoding
module. - Improved type coverage in the fuzz testing modules and gave the message
definitions fixed field tags so existing fuzzing corpora will be maximally
useful. - Internals: Ironed out a lingering annoyance with the field decoding APIs; the
Decoder
traits no longer accept aduplicated
boolean argument that
mandates returning an error when it is true. Instead, message implementations
that have defined fields are responsible for creating the
UnexpectedlyRepeated
decoding error themselves.
v0.1011.1
V0.1011.1
Fixes
- Oneof enums can now implement distinguished decoding even when one or more of
their variants has a type with no "empty" state. 🎊
v0.1011.0
v0.1011.0
Breaking changes
- The (unstable) internal encoding traits & types continue to evolve.
Oneof
traits now encode and decode slightly differently and the traits
bearing an empty state now have special responsibility for guarding against
value duplication and recording error locations.- Distinguished encoding traits now use a different context type,.
RestrictedDecodeContext
, which restricts the minimum tolerated canonicity
and allows for early exits and detailed errors about the location of
non-canonical data problems. DecodeContext
now has public method visibility.
New features
- Added support for
core::time::Duration
andstd::time::SystemTime
. - Added 3rd party type support for the
bstr
crate and itsBString
type,
which is a wrapper aroundVec<u8>
that acts like text but does not guarantee
UTF-8 and does not require any validation. - Added 3rd party type support for the
chrono
andtime
crates and most of
their important types, available through new crate features. Oneof
types can now be wrapped inBox
(multiple times even, and either
side ofOption
if you really want.)DistinguishedMessage
: added "restricted" and "canonical" decoding methods
alongside the existing "distinguished" ones, allowing decoding to stop early
on canonicity errors.
Fixes
- Rectify an ambiguous usage of
PartialEq
that could potentially cause
compilation failures when supported types in the program support cross-type
equality. bilrost-derive
: simplify some codegen to remove a needlesslet mut
in
derived decoding implementations.
Cleanups
bilrost-types
: parsing fractional seconds with more than 9 digits now
simply truncates instead of erring.bilrost-types
: parsing timestamps with "unknown local offset" timezones
("-00:00") is now tolerated, since the timezone information is discarded
anyway.bilrost-types
: improved fuzzing binaries for datetime parsing.- New keywords and categories have been added to the crate metadata.
- Various small cleanups to the readme and to the code as
rustfmt
andclippy
develop more and stronger opinions. - Major reorganization of type implementations, especially of common value-trait
implementations and third-party types. All that code is now filed under
encoding::type_support
and conditionally enabled at the file level. Impls
for primitive and core types in the builtin encoders are still in those
encoders' modules, but thevalue_traits
module now contains only traits and
macros and all conditionally-enabled code has been moved intotype_support
. - A new fuzzer binary is available specifically for the newer types which have
the newer, slightly more abstract encoding paths. These fuzzers are typically
run in the order of hundreds to thousands of CPU hours per significant change,
and are available for you to run as well.
v0.1010.1
v0.1010.1
Cleanups
bilrost-types
: parsing fractional seconds with more than 9 digits now
simply truncates instead of erring.bilrost-types
: parsing timestamps with "unknown local offset" timezones
("-00:00") is now tolerated, since the timezone information is discarded
anyway.bilrost-types
: improved fuzzing binaries for datetime parsing.
v0.1010.0
v0.1010.0
New features
- The optimization-controlling crate features have changed. There are now three
features for each: from lowest to highest priority, "auto-feature",
"prefer-no-feature", and "feature". This gives downstream crates the ability
to turn a given optimization either on or off even if a library enables the
"auto" feature. Only the "prefer-no-*" crate features are new.
Fixes
- Fixed a crash, wrong results for dates in early year 1900, and tolerance of
some incorrect inputs inbilrost_types::Timestamp
's conversion from strings.
v0.1009.0
v0.1009.0
New features
- Added
encode_contiguous
andencode_length_delimited_contiguous
APIs to the
Message
trait which use theencode_fast
prepend-encoding code path but
measure the size first to always produce a contiguous buffer. - Added
into_vec(self)
toReverseBuffer
complete with a non-copying
optimization when the buffer is full and contiguous, such as when it is
produced byMessage::encode_contiguous
.
v0.1008.0
v0.1008.0
Breaking changes
- The (unstable) internal encoding traits continue to evolve, now making checks
for whether a value decoded in distinguished mode was empty optional at the
value-decoder trait level. It is not always faster to check emptiness while
decoding a value, and letting the distinguished value decoder implementation
specify whether it takes responsibility for checking emptiness enables new
type support like better nesting of never-empty types as described below.
Fixes
- Enumerations that do not have a defined zero value (and therefore do not have
an "empty" state) can now be nested in fixed-size arrays as long as they are
nested again, such as in anOption
orVec
.
Cleanups
- Renamed the
NewForOverwrite
value trait toForOverwrite
. - Restructured so that
ForOverwrite
is now a supertrait ofEmptyState
, and
every existing implementation ofEmptyState::empty
defers toForOverwrite
.
v0.1007.0
v0.1007.0
Breaking changes
- Tuple typed structs (with anonymous fields accessed like
value.0
) now start
their field numbering from zero by default, matching the names of the fields. - Renamed the
.reader()
method onReverseBuffer
to.buf_reader()
so it no
longer conflicts with thebytes::Buf
method.
New features
- Added support for encoding
usize
andisize
pointer-sized integers. They
will still have different supported maximums on platforms with different sized
values, but this still has completely reasonable failure modes. - Added support for deriving
Message
forenum
types, which is implemented in
terms ofOneof
. The message implementations encode and decode exactly like a
message which contains only that oneof; see the readme for more details. - Changed the
Value
type inbilrost-types
to be a message-via-oneof in this
way, making it much nicer to use without changing its meaning. - Added a
.slices()
method toReverseBuffer
andReverseBufferReader
which
iterates its slices, useful for sending towrite_vectored
.
Fixes
- Fixed some incorrect tests, including coverage of third-party inline vecs and
packed/unpacked fixed-size arrays.
Cleanups
- Cleaned up and re-added fuzzers! Fuzzers are available via both
libfuzzer
andafl
; seeFUZZING.md
for usage details. These fuzzers
would have caught the bug fixed in 0.1006.1 :) - Deduplicated and somewhat improved codegen for oneofs. All four kinds of oneof
decoder function are now generated by the same code, which is a huge
improvement over four independent generators. - Added tests for detailed errors attribution of decoding errors to the specific
field that caused the problem.
v0.1006.0
v0.1006.0
Breaking changes
- The (unstable) internal encoding traits continue to evolve, now varying the
implementation ofTagMeasurer
and moving the "allow empty" argument of
distinguished value decoding into a const generic param.
New features
- Hash maps and hash sets can now have any kind of hasher, as long as the
BuildHasher
implementsDefault
. - Plain tuples can now be encoded as message fields! Tuples encode exactly the
same as messages with field tags 0 through N-1, but the encoding of each field
in the tuple can be specified. See the readme for more information. - Fixed-size arrays (
[T; N]
) can now also be encoded as message fields. Arrays
encode exactly the same as a collection likeVec
would, except if each value
in the array is empty the whole array is considered empty. When decoding an
array, if a nonzero number of items is present and it is not the same number
of items as the size of the array, the value and message being decoded are
considered to be invalid. - A couple third-party alternative types for
Vec
that have bounded size and
inline-only storage (ArrayVec
from thearrayvec
andtinyvec
crates) have
been added. - Third-party alternative types for
Vec
now also work withu8
items and the
plainbytes
encoding.
Fixes
- Added a
Self: Default
bound to the impl forMessage
when there are ignored
fields. This means that it can be possible to have a message type with ignored
fields and generically typed fields that don't implementDefault
; rather
than failing to compile, it will now simply not implementMessage
.
Cleanups
- Consolidated (almost) all the standard impls of the
EmptyState
trait into
the same module.