Skip to content

0.10.0

Latest
Compare
Choose a tag to compare
@wrenger wrenger released this 19 Dec 10:25

This release includes an option to disable automatic Copy and Clone implementation. This might be useful when you want to implement your own Clone.

/// We have a custom clone implementation -> opt out
#[bitfield(u64, clone = false)]
struct Full {
    data: u64,
}

impl Clone for Full {
    fn clone(&self) -> Self {
        Self::new().with_data(self.data())
    }
}

impl Copy for Full {}

Thanks to @kevinhartman for implementing this :)

From this release on, the set_<field> and set_<field>_checked setters are const. This is possible due to Rust 1.83.0 stabilizing const mut refs. Consequently, the minimum supported Rust version was bumped to 1.83.0. This also opens the door to a more generic bitfield representation (#7).