Skip to content

Commit

Permalink
add display trait
Browse files Browse the repository at this point in the history
  • Loading branch information
axic committed Mar 31, 2021
1 parent 5386c85 commit 8bc7c36
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions bindings/rust/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,12 @@ impl CErrorContainer {
}
}

impl std::fmt::Display for CErrorContainer {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
write!(f, "{} [{}]", self.code(), self.message())
}
}

/// Parse and validate the input according to WebAssembly 1.0 rules. Returns true if the supplied input is valid.
pub fn validate<T: AsRef<[u8]>>(input: T) -> Result<(), String> {
let mut err = CErrorContainer::new();
Expand Down

0 comments on commit 8bc7c36

Please sign in to comment.