Skip to content

Commit

Permalink
Bump version number, update changelog
Browse files Browse the repository at this point in the history
  • Loading branch information
danlehmann committed Dec 13, 2024
1 parent ebf2edf commit 2d70595
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 7 deletions.
Binary file added .DS_Store
Binary file not shown.
Binary file added bitbybit-tests/.DS_Store
Binary file not shown.
2 changes: 1 addition & 1 deletion bitbybit-tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ publish = false

[dependencies]
bitbybit = { path = "../bitbybit" }
arbitrary-int = "1.2.7"
arbitrary-int = "1.3.0"

[features]
# This is to allow cfg for enum members
Expand Down
Binary file added bitbybit/.DS_Store
Binary file not shown.
7 changes: 7 additions & 0 deletions bitbybit/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog

## bitbybit 1.3.3

### Fixed

- `with_` methods in the builder now produce `///` documentation.
- Bump to arbitrary_int 1.3.0

## bitbybit 1.3.2

### Fixed
Expand Down
4 changes: 2 additions & 2 deletions bitbybit/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "bitbybit"
version = "1.3.2"
version = "1.3.3"
authors = ["Daniel Lehmann <[email protected]>"]
edition = "2021"
description = "Efficient implementation of bit-fields where several numbers are packed within a larger number and bit-enums. Useful for drivers, so it works in no_std environments"
Expand All @@ -19,4 +19,4 @@ proc-macro = true
syn = { version = "2.0", features = ["full"] }
quote = "1.0"
proc-macro2 = "1.0"
arbitrary-int = "1.2.7"
arbitrary-int = "1.3.0"
13 changes: 9 additions & 4 deletions bitbybit/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ How this works:

- #[bitfield(u32)] specifies that this is a bitfield in which u32 is the underlying data type. This means that all the
bits inside of the bitfield
have to fit within 32 bits. Built-in Rust types (u8, u16, u32, u64, u128) as well as arbitrary-ints (u17, u48 etc) are supported.
have to fit within 32 bits. Built-in Rust types (u8, u16, u32, u64, u128) as well as arbitrary-ints (u17, u48 etc) are
supported.
- Each field is annotated with the range of bits that are used by the field. The data type must match the number of
bits: A range of 0..=8 with u8 would cause a compile error, as u9 is the data type that matches 0..=8.
- Single bit fields are declared as "bit", all other fields as "bits"
Expand Down Expand Up @@ -153,6 +154,7 @@ Default values are used as-is, even if they affect bits that aren't defined with
## Setting all fields at once using the builder syntax

It is possible to set all fields at once, like this:

```rs
const T: Test = Test::builder()
.with_baudrate(0x12)
Expand All @@ -161,11 +163,14 @@ const T: Test = Test::builder()
.build();
```

Using `builder()` it is impossible to forget setting any fields. This is checked at compile time: If any field is not set, `build()` can not be called.
Using `builder()` it is impossible to forget setting any fields. This is checked at compile time: If any field is not
set, `build()` can not be called.

At the moment, it is required to set all fields in the same order as they are specified. As Rust's const generics become more powerful, this restriction might be lifted.
At the moment, it is required to set all fields in the same order as they are specified. As Rust's const generics become
more powerful, this restriction might be lifted.

For the `builder()` to be available, the following has to be true:

- The bitfield has to be completely filled with writable fields (no gaps) OR there has to be a default value specified,
- No writable fields overlap.

Expand All @@ -187,7 +192,7 @@ immediates in a way that they have to be reassembled. This can be achieved like
Arbitrary bit widths like u5 or u67 do not exist in Rust at the moment. Therefore, the following dependency is required:

```toml
arbitrary-int = "1.2.7"
arbitrary-int = "1.3.0"
```

## Usage
Expand Down
Binary file added bitbybit/src/.DS_Store
Binary file not shown.

0 comments on commit 2d70595

Please sign in to comment.