Releases: bitflags/bitflags
2.1.0
What's Changed
- Add docs for the internal Field0 and examples of formatting/parsing by @KodrAus in #328
- Add support for arbitrary by @KodrAus in #324
- Fix up missing docs for consts within consts by @KodrAus in #330
- Ignore clippy lint in generated code by @Jake-Shadle in #331
- Prepare for 2.1.0 release by @KodrAus in #334
New Contributors
- @Jake-Shadle made their first contribution in #331
Full Changelog: 2.0.2...2.1.0
2.0.2
2.0.1
2.0.0
Major changes
This release includes some major changes over 1.x
. If you use bitflags!
types in your public API then upgrading this library may cause breakage in your downstream users.
⚠️ Serialization
You'll need to add the serde
Cargo feature in order to #[derive(Serialize, Deserialize)]
on your generated flags types:
bitflags! {
#[derive(Serialize, Deserialize)]
#[serde(transparent)]
pub struct Flags: T {
..
}
}
where T
is the underlying bits type you're using, such as u32
.
The default serialization format with serde
has changed if you #[derive(Serialize, Deserialize)]
on your generated flags types. It will now use a formatted string for human-readable formats and the underlying bits type for compact formats.
To keep the old format, see the https://github.com/KodrAus/bitflags-serde-legacy library.
⚠️ Traits
Generated flags types now derive fewer traits. If you need to maintain backwards compatibility, you can derive the following yourself:
#[derive(PartialEq, Eq, PartialOrd, Ord, Hash, Debug, Clone, Copy)]
⚠️ Methods
The unsafe from_bits_unchecked
method is now a safe from_bits_retain
method.
You can add the following method to your generated types to keep them compatible:
#[deprecated = "use the safe `from_bits_retain` method instead"]
pub unsafe fn from_bits_unchecked(bits: T) -> Self {
Self::from_bits_retain(bits)
}
where T
is the underlying bits type you're using, such as u32
.
⚠️ .bits
field
You can now use the .bits()
method instead of the old .bits
.
The representation of generated flags types has changed from a struct with the single field bits
to a newtype.
Contributions
- Fix a typo and call out MSRV bump by @KodrAus in #259
- BitFlags trait by @arturoc in #220
- Add a hidden trait to discourage manual impls of BitFlags by @KodrAus in #261
- Sanitize
Ok
by @konsumlamm in #266 - Fix bug in
Debug
implementation by @konsumlamm in #268 - Fix a typo in the generated documentation by @wackbyte in #271
- Use SPDX license format by @atouchet in #272
- serde tests fail in CI by @arturoc in #277
- Fix beta test output by @KodrAus in #279
- Add example to the README.md file by @tiaanl in #270
- Iterator over all the enabled options by @arturoc in #278
- from_bits_(truncate) fail with composite flags by @arturoc in #276
- Add more platform coverage to CI by @KodrAus in #280
- rework the way cfgs are handled by @KodrAus in #281
- Split generated code into two types by @KodrAus in #282
- expose bitflags iters using nameable types by @KodrAus in #286
- Support creating flags from their names by @KodrAus in #287
- Update README.md by @KodrAus in #288
- Prepare for 2.0.0-rc.1 release by @KodrAus in #289
- Add missing "if" to contains doc-comment in traits.rs by @rusty-snake in #291
- Forbid unsafe_code by @fintelia in #294
- serde: enable no-std support by @nim65s in #296
- Add a parser for flags formatted as bar-separated-values by @KodrAus in #297
- Prepare for 2.0.0-rc.2 release by @KodrAus in #299
- Use strip_prefix instead of starts_with + slice by @QuinnPainter in #301
- Fix up some clippy lints by @KodrAus in #302
- Prepare for 2.0.0-rc.3 release by @KodrAus in #303
- feat: Add minimum permissions to rust.yml workflow by @gabibguti in #305
- fix a nit in the readme by @s1rius in #307
- Prepare for 2.0.0 release by @KodrAus in #306
New Contributors
- @wackbyte made their first contribution in #271
- @atouchet made their first contribution in #272
- @tiaanl made their first contribution in #270
- @rusty-snake made their first contribution in #291
- @fintelia made their first contribution in #294
- @nim65s made their first contribution in #296
- @QuinnPainter made their first contribution in #301
- @gabibguti made their first contribution in #305
- @s1rius made their first contribution in #307
Full Changelog: 1.3.2...2.0.0
2.0.0-rc.3
What's Changed
- Use strip_prefix instead of starts_with + slice by @QuinnPainter in #301
- Fix up some clippy lints by @KodrAus in #302
- Prepare for 2.0.0-rc.3 release by @KodrAus in #303
New Contributors
- @QuinnPainter made their first contribution in #301
Full Changelog: 2.0.0-rc.2...2.0.0-rc.3
2.0.0-rc.2
#[derive(Serialize, Deserialize)]
on your generated flags types. It will now use a formatted string for human-readable formats and the underlying bits
type for compact formats.
What's Changed
- Add missing "if" to contains doc-comment in traits.rs by @rusty-snake in #291
- Forbid unsafe_code by @fintelia in #294
- serde: enable no-std support by @nim65s in #296
- Add a parser for flags formatted as bar-separated-values by @KodrAus in #297
- Prepare for 2.0.0-rc.2 release by @KodrAus in #299
New Contributors
- @rusty-snake made their first contribution in #291
- @fintelia made their first contribution in #294
- @nim65s made their first contribution in #296
Full Changelog: 2.0.0-rc.1...2.0.0-rc.2
2.0.0-rc.1
What's Changed
- Fix a typo and call out MSRV bump by @KodrAus in #259
- BitFlags trait by @arturoc in #220
- Add a hidden trait to discourage manual impls of BitFlags by @KodrAus in #261
- Sanitize
Ok
by @konsumlamm in #266 - Fix bug in
Debug
implementation by @konsumlamm in #268 - Fix a typo in the generated documentation by @wackbyte in #271
- Use SPDX license format by @atouchet in #272
- serde tests fail in CI by @arturoc in #277
- Fix beta test output by @KodrAus in #279
- Add example to the README.md file by @tiaanl in #270
- Iterator over all the enabled options by @arturoc in #278
- from_bits_(truncate) fail with composite flags by @arturoc in #276
- Add more platform coverage to CI by @KodrAus in #280
- rework the way cfgs are handled by @KodrAus in #281
- Split generated code into two types by @KodrAus in #282
- expose bitflags iters using nameable types by @KodrAus in #286
- Support creating flags from their names by @KodrAus in #287
- Update README.md by @KodrAus in #288
- Prepare for 2.0.0-rc.1 release by @KodrAus in #289
New Contributors
- @wackbyte made their first contribution in #271
- @atouchet made their first contribution in #272
- @tiaanl made their first contribution in #270
Full Changelog: 1.3.2...2.0.0-rc.1
1.3.2
1.3.1
1.3.0 (yanked)
-
Add
#[repr(transparent)]
(#187) -
End
empty
doc comment with full stop (#202) -
Fix typo in crate root docs (#206)
-
Document from_bits_unchecked unsafety (#207)
-
Let
is_all
ignore extra bits (#211) -
Allows empty flag definition (#225)
-
Making crate accessible from std (#227)
-
Make
from_bits
a const fn (#229) -
Allow multiple bitflags structs in one macro invocation (#235)
-
Add named functions to perform set operations (#244)
-
Fix typos in method docs (#245)
-
Modernization of the
bitflags
macro to take advantage of newer features and 2018 idioms (#246) -
Fix regression (in an unreleased feature) and simplify tests (#247)
-
Use
Self
and fix bug when overridingstringify!
(#249)