-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
primitive wrapper types for u16 & u32 #97
Conversation
Codecov Report
@@ Coverage Diff @@
## master #97 +/- ##
==========================================
+ Coverage 67.07% 67.36% +0.28%
==========================================
Files 62 63 +1
Lines 5260 5331 +71
==========================================
+ Hits 3528 3591 +63
- Misses 1732 1740 +8
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
really love the compiler safety this change introduces.
one more comment, fix the commit message. it's too long. see our contributing guideline. lol
core/src/packets/types.rs
Outdated
use std::fmt; | ||
use std::ops; | ||
|
||
/// Big-endian wrapper type for `u16`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The 16-bit unsigned integer in big-endian order.
core/src/packets/types.rs
Outdated
|
||
impl u16be { | ||
/// U16 Big-Endian 0 | ||
pub const BE0: u16be = u16be(0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
actually we can call this MIN
, and we can copy the doc over as well. why not.
The smallest value that can be represented by this integer type.
f44ba65
to
2d57ab1
Compare
2d57ab1
to
6699d6c
Compare
…packet data to/from network byte order - impls bit and/or/xor/*assign and not (!) for types - includes updates throughout the packets module to use these types - added flag tests
6699d6c
to
c5cdf8f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few small comments. once addressed. 👍
core/src/packets/types.rs
Outdated
pub struct u16be(pub u16); | ||
|
||
impl u16be { | ||
/// The 16-bit unsigned integer in big-endian order. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you made this change in the wrong place. this is for the main type description above. description here should be,
The smallest value that can be represented by this integer type.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
derp.
core/src/testils/criterion.rs
Outdated
@@ -34,10 +34,10 @@ use std::time::{Duration, Instant}; | |||
pub trait BencherExt { | |||
/// Times a `routine` with an input generated via a `proptest strategy` | |||
/// batch of input, and then times the iteration of the benchmark over the | |||
/// input. See [`BatchSize`] for details on choosing the batch size. The | |||
/// input. See [BatchSize] for details on choosing the batch size. The |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is actually a rust type.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
diff lib, but ok, yeah.
core/src/testils/proptest/mod.rs
Outdated
@@ -16,12 +16,12 @@ | |||
* SPDX-License-Identifier: Apache-2.0 | |||
*/ | |||
|
|||
//! Defines extended [`proptest`] [`Arbitrary`] traits and [`Strategies`] for | |||
//! Defines extended [proptest] [Arbitrary] traits and [Strategies] for |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Arbitrary and Strategy are both traits. Maybe change Strategies to singular? Something like
Defines extended proptest
Arbitrary
andStrategy
traits...
primitive wrapper types for u16 & u32 to ensure proper conversion of packet data to/from network byte order. Includes: - impls bit and/or/xor/*assign and not (!) for types - includes updates throughout the packets module to use these types - additional flag tests
Description
"new" types to ensure proper conversion of packet data to/from network byte order.
Includes:
Notes:
Checklist