Struct subxt_codegen::TypeSubstitutes
source · pub struct TypeSubstitutes { /* private fields */ }Expand description
A map of type substitutes. We match on the paths to generated types in order to figure out when to swap said type with some provided substitute.
Implementations§
source§impl TypeSubstitutes
impl TypeSubstitutes
sourcepub fn new(crate_path: &CratePath) -> Self
pub fn new(crate_path: &CratePath) -> Self
Create a new set of type substitutes with some default substitutions in place.
sourcepub fn insert(
&mut self,
source: Path,
target: AbsolutePath
) -> Result<(), TypeSubstitutionError>
pub fn insert( &mut self, source: Path, target: AbsolutePath ) -> Result<(), TypeSubstitutionError>
Insert the given substitution, overwriting any other with the same path.
sourcepub fn insert_if_not_exists(
&mut self,
source: Path,
target: AbsolutePath
) -> Result<(), TypeSubstitutionError>
pub fn insert_if_not_exists( &mut self, source: Path, target: AbsolutePath ) -> Result<(), TypeSubstitutionError>
Only insert the given substitution if a substitution at that path doesn’t already exist.
sourcepub fn extend(
&mut self,
elems: impl IntoIterator<Item = (Path, AbsolutePath)>
) -> Result<(), TypeSubstitutionError>
pub fn extend( &mut self, elems: impl IntoIterator<Item = (Path, AbsolutePath)> ) -> Result<(), TypeSubstitutionError>
Add a bunch of source to target type substitutions.
sourcepub fn contains(&self, path: impl Into<PathSegments>) -> bool
pub fn contains(&self, path: impl Into<PathSegments>) -> bool
Given a source type path, return whether a substitute exists for it.
sourcepub fn for_path_with_params(
&self,
path: impl Into<PathSegments>,
params: &[TypePath]
) -> Option<TypePathType>
pub fn for_path_with_params( &self, path: impl Into<PathSegments>, params: &[TypePath] ) -> Option<TypePathType>
Given a source type path and the resolved, supplied type parameters, return a new path and optionally overwritten type parameters.