pub struct TransactionInput {
pub input: Option<Bytes>,
pub data: Option<Bytes>,
}eth only.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 const fn new(data: Bytes) -> TransactionInput
pub const fn new(data: Bytes) -> TransactionInput
Creates a new instance with the given input data.
Sourcepub fn both(data: Bytes) -> TransactionInput
pub fn both(data: Bytes) -> TransactionInput
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>) -> TransactionInput
pub const fn maybe_input(input: Option<Bytes>) -> TransactionInput
Creates a new instance with the given input data.
Sourcepub fn maybe_both(input: Option<Bytes>) -> TransactionInput
pub fn maybe_both(input: Option<Bytes>) -> TransactionInput
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) -> TransactionInput
pub fn normalized_input(self) -> TransactionInput
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) -> TransactionInput
pub fn normalized_data(self) -> TransactionInput
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) -> TransactionInput
pub fn with_both(self) -> TransactionInput
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<'arbitrary> Arbitrary<'arbitrary> for TransactionInput
impl<'arbitrary> Arbitrary<'arbitrary> for TransactionInput
Source§fn arbitrary(
u: &mut Unstructured<'arbitrary>,
) -> Result<TransactionInput, Error>
fn arbitrary( u: &mut Unstructured<'arbitrary>, ) -> Result<TransactionInput, Error>
Self from the given unstructured data. Read moreSource§fn arbitrary_take_rest(
u: Unstructured<'arbitrary>,
) -> Result<TransactionInput, Error>
fn arbitrary_take_rest( u: Unstructured<'arbitrary>, ) -> Result<TransactionInput, Error>
Self from the entirety of the given
unstructured data. Read moreSource§fn size_hint(depth: usize) -> (usize, Option<usize>)
fn size_hint(depth: usize) -> (usize, Option<usize>)
Unstructured this type
needs to construct itself. Read moreSource§fn try_size_hint(
depth: usize,
) -> Result<(usize, Option<usize>), MaxRecursionReached>
fn try_size_hint( depth: usize, ) -> Result<(usize, Option<usize>), MaxRecursionReached>
Unstructured this type
needs to construct itself. Read moreSource§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<TransactionInput, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<TransactionInput, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl From<Bytes> for TransactionInput
impl From<Bytes> for TransactionInput
Source§fn from(input: Bytes) -> TransactionInput
fn from(input: Bytes) -> 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
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
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§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 moreSource§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
Source§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
Source§fn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 64 bytes