Skip to content

Add bin-proto support#97

Merged
danlehmann merged 1 commit intodanlehmann:mainfrom
wojciech-graj:bin-proto
Feb 2, 2026
Merged

Add bin-proto support#97
danlehmann merged 1 commit intodanlehmann:mainfrom
wojciech-graj:bin-proto

Conversation

@wojciech-graj
Copy link
Contributor

At work we're encoding/decoding types from arbitrary-int using the bin-proto crate. It would be useful to add support for this to arbitrary-int, so we don't have to maintain a fork.

But I also understand that this is additional maintenance burden (however small), so if that's an issue, we'll stick with the fork approach.

@danlehmann
Copy link
Owner

Sorry, this one fell through the cracks. Would you mind reopening this PR?

@wojciech-graj wojciech-graj reopened this Feb 2, 2026
@wojciech-graj
Copy link
Contributor Author

No worries, maintaining open-source software is thankless work, so take your time

Copy link
Owner

@danlehmann danlehmann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried to come up with a more elegant BITS solution but couldn't make that work (on stable).

Excellent patch. Well tested and everything looks great to me. Thanks!

// generic bit width.
macro_rules! impl_bin_proto {
($type:tt, $trait:ident) => {
impl_bin_proto!($type, $trait, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sigh...probably one of the poor decisions given that u8::BITS is u32

Could consider changing this for an arbitrary-int 3.0 release

@danlehmann danlehmann merged commit 0a02379 into danlehmann:main Feb 2, 2026
30 checks passed
@danlehmann
Copy link
Owner

Oh we forgot the changelog. I wrote up an entry here: #99

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants