pub struct Packet {
pub seq_on_a: Sequence,
pub port_id_on_a: PortId,
pub chan_id_on_a: ChannelId,
pub port_id_on_b: PortId,
pub chan_id_on_b: ChannelId,
pub data: Vec<u8>,
pub timeout_height_on_b: TimeoutHeight,
pub timeout_timestamp_on_b: Timestamp,
}
Expand description
The packet type; this is what applications send to one another.
Each application defines the structure of the data
field.
Fields§
§seq_on_a: Sequence
§port_id_on_a: PortId
§chan_id_on_a: ChannelId
§port_id_on_b: PortId
§chan_id_on_b: ChannelId
§data: Vec<u8>
§timeout_height_on_b: TimeoutHeight
§timeout_timestamp_on_b: Timestamp
Implementations§
source§impl Packet
impl Packet
sourcepub fn timed_out(
&self,
dst_chain_ts: &Timestamp,
dst_chain_height: Height
) -> bool
pub fn timed_out( &self, dst_chain_ts: &Timestamp, dst_chain_height: Height ) -> bool
Checks whether a packet from a
SendPacket
event is timed-out relative to the current state of the
destination chain.
Checks both for time-out relative to the destination chain’s
current timestamp dst_chain_ts
as well as relative to
the height dst_chain_height
.
Note: a timed-out packet should result in a
MsgTimeout
,
instead of the common-case where it results in
MsgRecvPacket
.
Trait Implementations§
source§impl BorshDeserialize for Packet
impl BorshDeserialize for Packet
fn deserialize_reader<R>(reader: &mut R) -> Result<Packet, Error>where
R: Read,
source§fn deserialize(buf: &mut &[u8]) -> Result<Self, Error>
fn deserialize(buf: &mut &[u8]) -> Result<Self, Error>
Deserializes this instance from a given slice of bytes.
Updates the buffer to point at the remaining bytes.
source§fn try_from_slice(v: &[u8]) -> Result<Self, Error>
fn try_from_slice(v: &[u8]) -> Result<Self, Error>
Deserialize this instance from a slice of bytes.
fn try_from_reader<R>(reader: &mut R) -> Result<Self, Error>where
R: Read,
source§impl BorshSerialize for Packet
impl BorshSerialize for Packet
source§impl Decode for Packet
impl Decode for Packet
source§fn decode<__CodecInputEdqy>(
__codec_input_edqy: &mut __CodecInputEdqy
) -> Result<Packet, Error>where
__CodecInputEdqy: Input,
fn decode<__CodecInputEdqy>(
__codec_input_edqy: &mut __CodecInputEdqy
) -> Result<Packet, Error>where
__CodecInputEdqy: Input,
Attempt to deserialise the value from input.
source§fn decode_into<I>(
input: &mut I,
dst: &mut MaybeUninit<Self>
) -> Result<DecodeFinished, Error>where
I: Input,
fn decode_into<I>(
input: &mut I,
dst: &mut MaybeUninit<Self>
) -> Result<DecodeFinished, Error>where
I: Input,
Attempt to deserialize the value from input into a pre-allocated piece of memory. Read more
source§impl<'de> Deserialize<'de> for Packet
impl<'de> Deserialize<'de> for Packet
source§fn deserialize<__D>(
__deserializer: __D
) -> Result<Packet, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D
) -> Result<Packet, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl Encode for Packet
impl Encode for Packet
source§fn size_hint(&self) -> usize
fn size_hint(&self) -> usize
If possible give a hint of expected size of the encoding. Read more
source§fn encode_to<__CodecOutputEdqy>(
&self,
__codec_dest_edqy: &mut __CodecOutputEdqy
)
fn encode_to<__CodecOutputEdqy>( &self, __codec_dest_edqy: &mut __CodecOutputEdqy )
Convert self to a slice and append it to the destination.
source§fn using_encoded<R, F>(&self, f: F) -> R
fn using_encoded<R, F>(&self, f: F) -> R
Convert self to a slice and then invoke the given closure with it.
source§fn encoded_size(&self) -> usize
fn encoded_size(&self) -> usize
Calculates the encoded size. Read more
source§impl JsonSchema for Packet
impl JsonSchema for Packet
source§fn schema_name() -> String
fn schema_name() -> String
The name of the generated JSON Schema. Read more
source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Returns a string that uniquely identifies the schema produced by this type. Read more
source§fn json_schema(gen: &mut SchemaGenerator) -> Schema
fn json_schema(gen: &mut SchemaGenerator) -> Schema
Generates a JSON Schema for this type. Read more
source§fn is_referenceable() -> bool
fn is_referenceable() -> bool
Whether JSON Schemas generated for this type should be re-used where possible using the
$ref
keyword. Read moresource§impl PartialEq for Packet
impl PartialEq for Packet
source§impl Serialize for Packet
impl Serialize for Packet
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,
Serialize this value into the given Serde serializer. Read more
impl EncodeLike for Packet
impl Eq for Packet
impl StructuralPartialEq for Packet
Auto Trait Implementations§
impl Freeze for Packet
impl RefUnwindSafe for Packet
impl Send for Packet
impl Sync for Packet
impl Unpin for Packet
impl UnwindSafe for Packet
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