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
Removed Default
from SerializedSignature
#458
Removed Default
from SerializedSignature
#458
Conversation
`Default` was pointless, so it was replaced with internal `from_raw_parts` method which also checks the length. This commit also documents changes to `SerializedSignature`. Closes rust-bitcoin#454
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.
utACK b18f5d0
/// Creates `SerializedSignature` from data and length. | ||
/// | ||
/// ## Panics | ||
/// | ||
/// If `len` > `MAX_LEN` |
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.
Pedantic style question I've been wondering about, if you have an opinion please. Since I started writing docs like these I've switched from using the format above to using no space after the heading when it looks 'spacey' (lots of whitespace). But its leading to non-uniform docs because once there is more text it looks better with the space. Do you have an opinion?
Without the space kinda looks nicer
/// Creates `SerializedSignature` from data and length.
///
/// ## Panics
/// If `len` > `MAX_LEN`
And a made up more wordy one with the newline seems to look nicer.
/// Creates `SerializedSignature` from data and length.
///
/// Once there is a long description that takes up a bunch of space saotnhsoaetsaotus s ossao
/// and goes onto a second line stnaho osanteusoan soa esnthaosu .
///
/// ## Panics
///
/// If `len` > `MAX_LEN`
Should we favor dogmatic uniformity (my go to :), or go with different newline spacing depending on the situation?
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 like to always have empty line after heading. I think changing this one would be just noise.
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.
Ok, I'm going to follow suit. I'll change any I come across that I wrote the other way :) Cheers.
#[inline] | ||
pub(crate) fn get_data_mut_ptr(&mut self) -> *mut u8 { | ||
self.data.as_mut_ptr() | ||
pub(crate) fn from_raw_parts(data: [u8; MAX_LEN], len: usize) -> 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.
This should have #[track_caller]
in MSRV 1.46
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.
ACK b18f5d0
Default
was pointless, so it was replaced with internalfrom_raw_parts
method which also checks the length.This commit also documents changes to
SerializedSignature
.Closes #454