mirror of
https://github.com/Cuprate/cuprate.git
synced 2024-12-22 03:29:25 +00:00
fix docs
This commit is contained in:
parent
789cd4d9c3
commit
2a91373691
1 changed files with 6 additions and 6 deletions
|
@ -12,12 +12,12 @@ const FITS_IN_FOUR_BYTES: u64 = 2_u64.pow(32 - SIZE_OF_SIZE_MARKER) - 1;
|
|||
/// ```rust
|
||||
/// use cuprate_epee_encoding::read_varint;
|
||||
///
|
||||
/// assert_eq!(read_varint(&mut [252].as_slice()).unwrap(), 63);
|
||||
/// assert_eq!(read_varint(&mut [1, 1].as_slice()).unwrap(), 64);
|
||||
/// assert_eq!(read_varint(&mut [253, 255].as_slice()).unwrap(), 16_383);
|
||||
/// assert_eq!(read_varint(&mut [2, 0, 1, 0].as_slice()).unwrap(), 16_384);
|
||||
/// assert_eq!(read_varint(&mut [254, 255, 255, 255].as_slice()).unwrap(), 1_073_741_823);
|
||||
/// assert_eq!(read_varint(&mut [3, 0, 0, 0, 1, 0, 0, 0].as_slice()).unwrap(), 1_073_741_824);
|
||||
/// assert_eq!(read_varint::<_, u64>(&mut [252].as_slice()).unwrap(), 63);
|
||||
/// assert_eq!(read_varint::<_, u64>(&mut [1, 1].as_slice()).unwrap(), 64);
|
||||
/// assert_eq!(read_varint::<_, u64>(&mut [253, 255].as_slice()).unwrap(), 16_383);
|
||||
/// assert_eq!(read_varint::<_, u64>(&mut [2, 0, 1, 0].as_slice()).unwrap(), 16_384);
|
||||
/// assert_eq!(read_varint::<_, u64>(&mut [254, 255, 255, 255].as_slice()).unwrap(), 1_073_741_823);
|
||||
/// assert_eq!(read_varint::<_, u64>(&mut [3, 0, 0, 0, 1, 0, 0, 0].as_slice()).unwrap(), 1_073_741_824);
|
||||
/// ```
|
||||
pub fn read_varint<B: Buf, T: TryFrom<u64>>(r: &mut B) -> Result<T> {
|
||||
if !r.has_remaining() {
|
||||
|
|
Loading…
Reference in a new issue