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
@@ -0,0 +1,21 @@
use crate::dynamic::DecodedValueThunk;
use crate::metadata::DecodeWithMetadata;
/// This represents the address of a custom value in in the metadata.
/// Anything, that implements the [CustomValueAddress] trait can be used, to fetch
/// custom values from the metadata.
pub trait CustomValueAddress {
/// The type of the custom value.
type Target: DecodeWithMetadata;
/// the name (key) by which the custom value can be accessed in the metadata.
fn name(&self) -> &str;
}
impl CustomValueAddress for str {
type Target = DecodedValueThunk;
fn name(&self) -> &str {
self
}
}