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 with_default_substitutes(crate_path: &CratePath) -> Self
pub fn with_default_substitutes(crate_path: &CratePath) -> Self
Creates a new TypeSubstitutes
with some default substitutions in place.
The crate_path
denotes the subxt
crate access path in the
generated code.
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.
Trait Implementations§
source§impl Debug for TypeSubstitutes
impl Debug for TypeSubstitutes
Auto Trait Implementations§
impl RefUnwindSafe for TypeSubstitutes
impl !Send for TypeSubstitutes
impl !Sync for TypeSubstitutes
impl Unpin for TypeSubstitutes
impl UnwindSafe for TypeSubstitutes
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more