V15 Metadata: Support accessing custom types (#1106)

* work in progress

* add custom types access

* nit

* custom values client

* adjust light client

* adjust doc comments

* adjust book for custom values in code gen

* format and check docs

* use ignore in docs in book
This commit is contained in:
Tadeo Hepperle
2023-08-11 14:49:29 +02:00
committed by GitHub
parent 9723a50969
commit 8ba113f368
15 changed files with 310 additions and 6 deletions
+8
View File
@@ -75,4 +75,12 @@ impl DecodedValueThunk {
)?;
Ok(val)
}
/// decode the `DecodedValueThunk` into a concrete type.
pub fn as_type<T: DecodeAsType>(&self) -> Result<T, scale_decode::Error> {
T::decode_as_type(
&mut &self.scale_bytes[..],
self.type_id,
self.metadata.types(),
)
}
}