Skip to content

Commit

Permalink
Merge pull request #77 from ralexstokes/add-docs
Browse files Browse the repository at this point in the history
add/hide docs so all public items are documented
  • Loading branch information
ralexstokes committed Jun 10, 2023
2 parents d72b6f9 + 39084be commit b872969
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 12 deletions.
2 changes: 2 additions & 0 deletions ssz-rs-test-gen/src/main.rs
Original file line number Diff line number Diff line change
@@ -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};
Expand Down
16 changes: 4 additions & 12 deletions ssz-rs/src/de.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand All @@ -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<InstanceError> for DeserializeError {
Expand Down
4 changes: 4 additions & 0 deletions ssz-rs/src/merkleization/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Node, MerkleizationError>;
}

/// 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),
}

Expand Down
1 change: 1 addition & 0 deletions ssz-rs/src/uint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit b872969

Please sign in to comment.