Skip to content

Commit

Permalink
Add comment explaining clone_node
Browse files Browse the repository at this point in the history
  • Loading branch information
Rigidity committed Nov 17, 2023
1 parent 5d79855 commit e2ec208
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions clvm-traits/src/clvm_decoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ pub trait ClvmDecoder {
fn decode_atom(&self, node: &Self::Node) -> Result<&[u8], FromClvmError>;
fn decode_pair(&self, node: &Self::Node) -> Result<(Self::Node, Self::Node), FromClvmError>;

/// This is a helper function that just calls `clone` on the node.
/// It's required only because the compiler can't infer that `N` is `Clone`,
/// since there's no `Clone` bound on the `FromClvm` trait.
fn clone_node(&self, node: &Self::Node) -> Self::Node {
node.clone()
}
Expand Down
3 changes: 3 additions & 0 deletions clvm-traits/src/clvm_encoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ pub trait ClvmEncoder {
rest: Self::Node,
) -> Result<Self::Node, ToClvmError>;

/// This is a helper function that just calls `clone` on the node.
/// It's required only because the compiler can't infer that `N` is `Clone`,
/// since there's no `Clone` bound on the `ToClvm` trait.
fn clone_node(&self, node: &Self::Node) -> Self::Node {
node.clone()
}
Expand Down

0 comments on commit e2ec208

Please sign in to comment.