File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -69,7 +69,7 @@ pub trait FixedWidthEncoding {
6969#[ derive( Debug ) ]
7070pub struct FixedWidthUint < ' a , T : FixedWidthEncoding + ?Sized > ( & ' a T ) ;
7171
72- impl < ' t , T : FixedWidthEncoding > CompactEncoding < T :: Decode > for FixedWidthUint < ' t , T > {
72+ impl < T : FixedWidthEncoding > CompactEncoding < T :: Decode > for FixedWidthUint < ' _ , T > {
7373 fn encoded_size ( & self ) -> Result < usize , EncodingError > {
7474 self . 0 . fw_encoded_size ( )
7575 }
Original file line number Diff line number Diff line change @@ -290,12 +290,18 @@ pub trait BoxArrayEncodable: CompactEncoding {
290290/// assert_eq!(result, 12);
291291/// # Ok::<(), Box<dyn std::error::Error>>(())
292292/// ```
293+ /// If you want to use this within a non-result context you can do
294+ /// ```
295+ /// # use crate::compact_encoding::{sum_encoded_size, CompactEncoding, EncodingError};
296+ /// let bar = 42u64;
297+ /// let result = (|| { Ok::<usize, EncodingError>(sum_encoded_size!(bar)) })().unwrap();
298+ /// assert_eq!(result, 1);
299+ /// ```
293300macro_rules! sum_encoded_size {
294301 ( $( $val: expr) ,+) => { {
295302 let out: usize = [
296303 $(
297304 $val. encoded_size( ) ?,
298-
299305 ) *
300306 ] . iter( ) . sum( ) ;
301307 out
You can’t perform that action at this time.
0 commit comments