Address a review comment concerning `Vector::serialized_size`.
Signed-off-by: Daira-Emma Hopwood <daira@jacaranda.org>
This commit is contained in:
parent
9881861228
commit
6f4a3b107e
|
@ -8,7 +8,7 @@ and this library adheres to Rust's notion of
|
|||
## [Unreleased]
|
||||
### Added
|
||||
- `zcash_encoding::CompactSize::serialized_size`
|
||||
- `zcash_encoding::Vector::serialized_size`
|
||||
- `zcash_encoding::Vector::serialized_size_of_u8_vec`
|
||||
|
||||
## [0.2.0] - 2022-10-19
|
||||
### Changed
|
||||
|
|
|
@ -183,7 +183,7 @@ impl Vector {
|
|||
}
|
||||
|
||||
/// Returns the serialized size of a vector of `u8` as written by `[Vector::write]`.
|
||||
pub fn serialized_size(vec: &[u8]) -> usize {
|
||||
pub fn serialized_size_of_u8_vec(vec: &[u8]) -> usize {
|
||||
let length = vec.len();
|
||||
CompactSize::serialized_size(length) + length
|
||||
}
|
||||
|
@ -341,7 +341,7 @@ mod tests {
|
|||
let mut data = vec![];
|
||||
Vector::write(&mut data, &$value, |w, e| w.write_u8(*e)).unwrap();
|
||||
assert_eq!(&data[..], &$expected[..]);
|
||||
let serialized_size = Vector::serialized_size(&$value);
|
||||
let serialized_size = Vector::serialized_size_of_u8_vec(&$value);
|
||||
assert_eq!(serialized_size, $expected.len());
|
||||
match Vector::read(&data[..], |r| r.read_u8()) {
|
||||
Ok(v) => assert_eq!(v, $value),
|
||||
|
|
|
@ -324,7 +324,7 @@ impl Script {
|
|||
|
||||
/// Returns the length of this script as encoded (including the initial CompactSize).
|
||||
pub fn serialized_size(&self) -> usize {
|
||||
Vector::serialized_size(&self.0)
|
||||
Vector::serialized_size_of_u8_vec(&self.0)
|
||||
}
|
||||
|
||||
/// Returns the address that this Script contains, if any.
|
||||
|
|
Loading…
Reference in New Issue