pub struct TransactionInput {
pub input: Option<Bytes>,
pub data: Option<Bytes>,
}Expand description
Helper type that supports both data and input fields that map to transaction input data.
This is done for compatibility reasons where older implementations used data instead of the
newer, recommended input field.
If both fields are set, it is expected that they contain the same value, otherwise an error is returned.
Fields§
§input: Option<Bytes>Transaction data
data: Option<Bytes>Transaction data
This is the same as input but is used for backwards compatibility: https://github.com/ethereum/go-ethereum/issues/15628
Implementations§
Source§impl TransactionInput
impl TransactionInput
Sourcepub fn both(data: Bytes) -> Self
pub fn both(data: Bytes) -> Self
Creates a new instance with the given input data and sets both input and data fields to
the same value.
Sourcepub const fn maybe_input(input: Option<Bytes>) -> Self
pub const fn maybe_input(input: Option<Bytes>) -> Self
Creates a new instance with the given input data.
Sourcepub fn maybe_both(input: Option<Bytes>) -> Self
pub fn maybe_both(input: Option<Bytes>) -> Self
Creates a new instance with the given input data and sets both input and data fields to
the same value.
Sourcepub fn into_input(self) -> Option<Bytes>
pub fn into_input(self) -> Option<Bytes>
Consumes the type and returns the optional input data.
Sourcepub fn normalize_input(&mut self)
pub fn normalize_input(&mut self)
Ensures that if either input or data is set, the input field contains the value.
This removes data the data field.
Sourcepub fn normalized_input(self) -> Self
pub fn normalized_input(self) -> Self
Consumes the type and returns it with Self::normalize_input applied
Sourcepub fn normalize_data(&mut self)
pub fn normalize_data(&mut self)
Ensures that if either data or input is set, the data field contains the value.
This removes input the data field.
Sourcepub fn normalized_data(self) -> Self
pub fn normalized_data(self) -> Self
Consumes the type and returns it with Self::normalize_data applied
Sourcepub fn set_both(&mut self)
pub fn set_both(&mut self)
If only one field is set, this also sets the other field by with that value.
This is a noop if both fields are already set.
Sourcepub fn with_both(self) -> Self
pub fn with_both(self) -> Self
Consumes the type and returns it with Self::set_both applied.
Sourcepub fn try_into_unique_input(
self,
) -> Result<Option<Bytes>, TransactionInputError>
pub fn try_into_unique_input( self, ) -> Result<Option<Bytes>, TransactionInputError>
Consumes the type and returns the optional input data.
Returns an error if both data and input fields are set and not equal.
Sourcepub fn unique_input(&self) -> Result<Option<&Bytes>, TransactionInputError>
pub fn unique_input(&self) -> Result<Option<&Bytes>, TransactionInputError>
Returns the optional input data.
Returns an error if both data and input fields are set and not equal.
Trait Implementations§
Source§impl Clone for TransactionInput
impl Clone for TransactionInput
Source§fn clone(&self) -> TransactionInput
fn clone(&self) -> TransactionInput
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for TransactionInput
impl Debug for TransactionInput
Source§impl Default for TransactionInput
impl Default for TransactionInput
Source§fn default() -> TransactionInput
fn default() -> TransactionInput
Source§impl<'de> Deserialize<'de> for TransactionInput
impl<'de> Deserialize<'de> for TransactionInput
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl From<Bytes> for TransactionInput
impl From<Bytes> for TransactionInput
Source§impl Hash for TransactionInput
impl Hash for TransactionInput
Source§impl PartialEq for TransactionInput
impl PartialEq for TransactionInput
Source§impl Serialize for TransactionInput
impl Serialize for TransactionInput
impl Eq for TransactionInput
impl StructuralPartialEq for TransactionInput
Auto Trait Implementations§
impl !Freeze for TransactionInput
impl RefUnwindSafe for TransactionInput
impl Send for TransactionInput
impl Sync for TransactionInput
impl Unpin for TransactionInput
impl UnwindSafe for TransactionInput
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more