Struct subxt_codegen::GenerateRuntimeApi
source · pub struct GenerateRuntimeApi { /* private fields */ }Expand description
Generate the runtime API for interacting with a substrate runtime.
Implementations§
source§impl GenerateRuntimeApi
impl GenerateRuntimeApi
sourcepub fn new(item_mod: ItemMod, crate_path: CratePath) -> Self
pub fn new(item_mod: ItemMod, crate_path: CratePath) -> Self
Construct a new GenerateRuntimeApi.
sourcepub fn derives_registry(self, derives: DerivesRegistry) -> Self
pub fn derives_registry(self, derives: DerivesRegistry) -> Self
Provide custom derives for the generated types.
Default is no derives.
sourcepub fn type_substitutes(self, type_substitutes: TypeSubstitutes) -> Self
pub fn type_substitutes(self, type_substitutes: TypeSubstitutes) -> Self
Provide custom type substitutes.
Default is no substitutes.
sourcepub fn generate_docs(self, should_gen_docs: bool) -> Self
pub fn generate_docs(self, should_gen_docs: bool) -> Self
True if the generated API contains the documentation from the metadata.
Default: false.
sourcepub fn runtime_types_only(self, runtime_types_only: bool) -> Self
pub fn runtime_types_only(self, runtime_types_only: bool) -> Self
Whether to limit code generation to only runtime types.
Default: false.
sourcepub fn unstable_metadata(self, unstable_metadata: bool) -> Self
pub fn unstable_metadata(self, unstable_metadata: bool) -> Self
Whether to fetch the unstable metadata first.
Note
This takes effect only if the API is generated from URL.
Default: false.
sourcepub fn generate_from_path<P>(
self,
path: P
) -> Result<TokenStream2, CodegenError>where
P: AsRef<Path>,
pub fn generate_from_path<P>( self, path: P ) -> Result<TokenStream2, CodegenError>where P: AsRef<Path>,
Generate the runtime API from path.
sourcepub fn generate_from_bytes(
self,
bytes: &[u8]
) -> Result<TokenStream2, CodegenError>
pub fn generate_from_bytes( self, bytes: &[u8] ) -> Result<TokenStream2, CodegenError>
Generate the runtime API from the provided metadata bytes.
sourcepub fn generate_from_url(self, url: Url) -> Result<TokenStream2, CodegenError>
pub fn generate_from_url(self, url: Url) -> Result<TokenStream2, CodegenError>
Generate the runtime API from URL.
The metadata will be downloaded from a node at the provided URL. This function blocks while retrieving the metadata.
Warning
Not recommended to be used in production environments.