From 12d0c5a04c7724d3eab01f8a123915b95fea3156 Mon Sep 17 00:00:00 2001 From: wucke13 Date: Mon, 19 Aug 2024 10:11:35 +0200 Subject: [PATCH] chore: extend documentation on `WasmReadable` Signed-off-by: wucke13 --- src/core/reader/mod.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/core/reader/mod.rs b/src/core/reader/mod.rs index 4e1fd85c..b7e6bf32 100644 --- a/src/core/reader/mod.rs +++ b/src/core/reader/mod.rs @@ -173,6 +173,15 @@ pub trait WasmReadable: Sized { /// which may lead to unexpected behaviour. /// To avoid this consider using the [`WasmReader::handle_transaction`] method to wrap this function call. fn read(wasm: &mut WasmReader) -> Result; + + /// Like [`read`](WasmReadable::read), but may panic + /// + /// Allows to read a value, directly returning the Value instead of a `Result`. + /// Useful, when prior validation already assured that a matching readable thing is in place. + /// + /// # Panic + /// + /// Panics if reading the given thing fails. fn read_unvalidated(wasm: &mut WasmReader) -> Self; }