From 39084be4db08aca48ee43cf7949f530e5ec65a50 Mon Sep 17 00:00:00 2001 From: Alex Stokes Date: Fri, 9 Jun 2023 18:53:09 -0600 Subject: [PATCH] add/hide docs so all public items are documented --- ssz-rs-test-gen/src/main.rs | 2 ++ ssz-rs/src/de.rs | 16 ++++------------ ssz-rs/src/merkleization/mod.rs | 4 ++++ ssz-rs/src/uint.rs | 1 + 4 files changed, 11 insertions(+), 12 deletions(-) diff --git a/ssz-rs-test-gen/src/main.rs b/ssz-rs-test-gen/src/main.rs index e94e4b51..1238ea19 100644 --- a/ssz-rs-test-gen/src/main.rs +++ b/ssz-rs-test-gen/src/main.rs @@ -1,3 +1,5 @@ +#![doc(hidden)] + use convert_case::{Case, Casing}; use num_bigint::BigUint; use std::{collections::BTreeMap, env, ffi::OsStr, fmt, fs, fs::DirEntry, path::PathBuf}; diff --git a/ssz-rs/src/de.rs b/ssz-rs/src/de.rs index e4ea52db..de6253d8 100644 --- a/ssz-rs/src/de.rs +++ b/ssz-rs/src/de.rs @@ -9,15 +9,10 @@ use crate::{ #[derive(Debug)] pub enum DeserializeError { /// More data was expected to be in the buffer. - ExpectedFurtherInput { - provided: usize, - expected: usize, - }, + ExpectedFurtherInput { provided: usize, expected: usize }, /// The buffer contained more data than expected. - AdditionalInput { - provided: usize, - expected: usize, - }, + AdditionalInput { provided: usize, expected: usize }, + /// An invalid byte was encountered when deserializing the given type InvalidByte(u8), /// An invalid instance was encountered. InvalidInstance(InstanceError), @@ -26,10 +21,7 @@ pub enum DeserializeError { /// The number of bytes used for length offsets wasn't a multiple of BYTES_PER_LENGTH_OFFSET. InvalidOffsetsLength(usize), /// An offset was found with start > end. - OffsetNotIncreasing { - start: usize, - end: usize, - }, + OffsetNotIncreasing { start: usize, end: usize }, } impl From for DeserializeError { diff --git a/ssz-rs/src/merkleization/mod.rs b/ssz-rs/src/merkleization/mod.rs index d3b4df96..33852097 100644 --- a/ssz-rs/src/merkleization/mod.rs +++ b/ssz-rs/src/merkleization/mod.rs @@ -12,14 +12,18 @@ pub use proofs::is_valid_merkle_branch; pub(crate) const BYTES_PER_CHUNK: usize = 32; +/// A `Merkleized` type provides a "hash tree root" following the SSZ spec. pub trait Merkleized { /// Compute the "hash tree root" of `Self`. fn hash_tree_root(&mut self) -> Result; } +/// An error encountered during merkleization. #[derive(Debug)] pub enum MerkleizationError { + /// An error serializing a type while computing the hash tree. SerializationError(SerializeError), + /// More data was provided than expected InputExceedsLimit(usize), } diff --git a/ssz-rs/src/uint.rs b/ssz-rs/src/uint.rs index 5c6cc1b8..fce99ff4 100644 --- a/ssz-rs/src/uint.rs +++ b/ssz-rs/src/uint.rs @@ -72,6 +72,7 @@ define_uint!(u64); define_uint!(u128); define_uint!(usize); +/// An unsigned integer represented by 256 bits #[derive(Default, Debug, PartialEq, Eq, Clone, PartialOrd, Ord, Hash)] pub struct U256(BigUint);