Skip to content

Releases: bitflags/bitflags

2.1.0

05 Apr 22:47
597d407
Compare
Choose a tag to compare

What's Changed

New Contributors

Full Changelog: 2.0.2...2.1.0

2.0.2

19 Mar 11:06
11640f1
Compare
Choose a tag to compare

What's Changed

Full Changelog: 2.0.1...2.0.2

2.0.1

16 Mar 02:03
8b43d2b
Compare
Choose a tag to compare

What's Changed

New Contributors

Full Changelog: 2.0.0...2.0.1

2.0.0

13 Mar 07:03
b5a5ecf
Compare
Choose a tag to compare

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

New Contributors

Full Changelog: 1.3.2...2.0.0

2.0.0-rc.3

19 Feb 23:31
13ed24d
Compare
Choose a tag to compare
2.0.0-rc.3 Pre-release
Pre-release

What's Changed

New Contributors

Full Changelog: 2.0.0-rc.2...2.0.0-rc.3

2.0.0-rc.2

10 Feb 12:37
0b84e40
Compare
Choose a tag to compare
2.0.0-rc.2 Pre-release
Pre-release

⚠️ NOTE ⚠️ This release changes the default serialization you'll get 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.

What's Changed

New Contributors

Full Changelog: 2.0.0-rc.1...2.0.0-rc.2

2.0.0-rc.1

07 Oct 07:16
a9ba127
Compare
Choose a tag to compare
2.0.0-rc.1 Pre-release
Pre-release

What's Changed

New Contributors

Full Changelog: 1.3.2...2.0.0-rc.1

1.3.2

16 Aug 04:16
ed185cf
Compare
Choose a tag to compare
  • Allow non_snake_case in generated flags types (#256)

1.3.1

12 Aug 03:34
b234906
Compare
Choose a tag to compare
  • Revert unconditional #[repr(transparent)] (#252)

1.3.0 (yanked)

11 Aug 22:52
971cf37
Compare
Choose a tag to compare
  • 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 overriding stringify! (#249)