-
Notifications
You must be signed in to change notification settings - Fork 136
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
Rust Docs framing_sv2
#848
Conversation
4602c5d
to
a8be4b6
Compare
a8be4b6
to
7eb4649
Compare
975c053
to
13774bf
Compare
13774bf
to
7936b29
Compare
/// - Returns a negative value if the byte slice is smaller than a Noise Frame header; this value | ||
/// represents how many bytes are missing. | ||
/// - Returns a positive value if the byte slice is longer than expected; this value | ||
/// indicates the surplus of bytes beyond the expected size. |
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.
Note for the future, it could make sense to return a type that encode the above infos: enum Ok, Bigger, Smaller. This would be an API change so for now I would live it like it is
/// deserialized (`self.serialized` is `None`, `self.payload` is `Some()`). | ||
/// This function is only intended as a fast way to get a reference to an | ||
/// already serialized payload. If the frame has not yet been | ||
/// serialized, this function should never be used (it will panic). |
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.
Can we add a warning here that is printed when compiled? So you have to explicitly opt out from it when you want to use this function?
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.
sorry @Fi3 I don't fully understand the suggestion
I did some research but couldn't find an easy way to print a warning during compilation.
I only found this pre-RFC which proposes a compile_warning!
macro but it will probably take a long time before this is available.
Do you have some examples on how to achieve this?
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.
No I was just supposing that it was already doable on stable, maybe we can leave a comment for our future self.
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.
well, as we already discussed briefly, I believe the framing_sv2
crate should be refactored in the future.
the Frame
trait is forcing Sv2Frame
and HandShakeFrame
to share APIs while they don't really share a lot of common features, and as a consequence we end up with APIs that are inuntuitive and dirty (e.g.: panic on undersired scenarios)
so if we're taking a note for the future, I think we should simply refactor this crate (removing the Frame
trait and re-writing the APIs) so that we don't need to be emitting compilation warnings to avoid footguns
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 wrote a summary of all things to be refactored on framing_sv2
in the future here:
#903
This comment was marked as resolved.
This comment was marked as resolved.
cb01f3f
to
0842773
Compare
73d477a
to
087edfd
Compare
087edfd
to
0fd8743
Compare
Bencher
Click to view all benchmark results
Bencher - Continuous Benchmarking View Public Perf Page Docs | Repo | Chat | Help |
Bencher
Click to view all benchmark results
Bencher - Continuous Benchmarking View Public Perf Page Docs | Repo | Chat | Help |
Bencher
Click to view all benchmark results
Bencher - Continuous Benchmarking View Public Perf Page Docs | Repo | Chat | Help |
Bencher
Click to view all benchmark results
Bencher - Continuous Benchmarking View Public Perf Page Docs | Repo | Chat | Help |
adds Rust Docs for
framing_sv2
, as described in #845also renames
NoiseFrame
intoHandShakeFrame
the documentation effort was guided by discussion with @Fi3 on #858