pub trait TransactionExtensions<Resolver: TypeResolver> {
// Required methods
fn contains_extension(&self, name: &str) -> bool;
fn encode_extension_value_to(
&self,
name: &str,
type_id: Resolver::TypeId,
type_resolver: &Resolver,
out: &mut Vec<u8>,
) -> Result<(), TransactionExtensionsError>;
fn encode_extension_implicit_to(
&self,
name: &str,
type_id: Resolver::TypeId,
type_resolver: &Resolver,
out: &mut Vec<u8>,
) -> Result<(), TransactionExtensionsError>;
// Provided method
fn is_authorization_extension(&self, _name: &str) -> bool { ... }
}Expand description
This trait can be implemented for anything which represents a set of transaction extensions.
It’s implemented by default for tuples of items which implement TransactionExtension.
Required Methods§
Sourcefn contains_extension(&self, name: &str) -> bool
fn contains_extension(&self, name: &str) -> bool
Is a given transaction extension contained within this set?
Sourcefn encode_extension_value_to(
&self,
name: &str,
type_id: Resolver::TypeId,
type_resolver: &Resolver,
out: &mut Vec<u8>,
) -> Result<(), TransactionExtensionsError>
fn encode_extension_value_to( &self, name: &str, type_id: Resolver::TypeId, type_resolver: &Resolver, out: &mut Vec<u8>, ) -> Result<(), TransactionExtensionsError>
This will be called given the name of each transaction extension we
wish to obtain the encoded bytes to. Implementations are expected to
write the bytes that should be included in the transaction to the given Vec,
or return an error if no such bytes can be written.
Sourcefn encode_extension_implicit_to(
&self,
name: &str,
type_id: Resolver::TypeId,
type_resolver: &Resolver,
out: &mut Vec<u8>,
) -> Result<(), TransactionExtensionsError>
fn encode_extension_implicit_to( &self, name: &str, type_id: Resolver::TypeId, type_resolver: &Resolver, out: &mut Vec<u8>, ) -> Result<(), TransactionExtensionsError>
This will be called given the name of each transaction extension we
wish to obtain the encoded bytes to. Implementations are expected to
write the bytes that should be included in the signer payload implicit
to the given Vec, or return an error if no such bytes can be written.
Provided Methods§
Does the named transaction extension authorize the transaction
(see TransactionExtension::is_authorization_extension)? This should
return false for any extension not contained within this set.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".