pub struct ChannelEnd {
pub state: State,
pub ordering: Order,
pub remote: Counterparty,
pub connection_hops: Vec<ConnectionId>,
pub version: Version,
}
Expand description
One end of a channel
Fields§
§state: State
§ordering: Order
§remote: Counterparty
§connection_hops: Vec<ConnectionId>
§version: Version
Implementations§
source§impl ChannelEnd
impl ChannelEnd
sourcepub fn new(
state: State,
ordering: Order,
remote: Counterparty,
connection_hops: Vec<ConnectionId>,
version: Version
) -> Result<ChannelEnd, ChannelError>
pub fn new( state: State, ordering: Order, remote: Counterparty, connection_hops: Vec<ConnectionId>, version: Version ) -> Result<ChannelEnd, ChannelError>
Creates a new ChannelEnd
with performing basic validation on its arguments.
pub fn set_version(&mut self, v: Version)
pub fn set_counterparty_channel_id(&mut self, c: ChannelId)
sourcepub fn is_open(&self) -> bool
pub fn is_open(&self) -> bool
Returns true
if this ChannelEnd
is in state State::Open
.
pub fn state(&self) -> &State
pub fn ordering(&self) -> &Order
pub fn counterparty(&self) -> &Counterparty
pub fn connection_hops(&self) -> &Vec<ConnectionId>
pub fn version(&self) -> &Version
pub fn validate_basic(&self) -> Result<(), ChannelError>
sourcepub fn verify_state_matches(&self, expected: &State) -> Result<(), ChannelError>
pub fn verify_state_matches(&self, expected: &State) -> Result<(), ChannelError>
Checks if the state of this channel end matches the expected state.
sourcepub fn verify_not_closed(&self) -> Result<(), ChannelError>
pub fn verify_not_closed(&self) -> Result<(), ChannelError>
Checks if the state of this channel end is not closed.
sourcepub fn order_matches(&self, other: &Order) -> bool
👎Deprecated since 0.50.1: Use Eq
or match
directly on the Order
enum instead
pub fn order_matches(&self, other: &Order) -> bool
Eq
or match
directly on the Order
enum insteadHelper function to compare the order of this end with another order.
pub fn connection_hops_matches(&self, other: &Vec<ConnectionId>) -> bool
sourcepub fn verify_counterparty_matches(
&self,
expected: &Counterparty
) -> Result<(), ChannelError>
pub fn verify_counterparty_matches( &self, expected: &Counterparty ) -> Result<(), ChannelError>
Checks if the counterparty of this channel end matches with an expected counterparty.
sourcepub fn verify_connection_hops_length(&self) -> Result<(), ChannelError>
pub fn verify_connection_hops_length(&self) -> Result<(), ChannelError>
Checks if the connection_hops
has a length of expected
.
Note: Current IBC version only supports one connection hop.
pub fn version_matches(&self, other: &Version) -> bool
Trait Implementations§
source§impl BorshDeserialize for ChannelEnd
impl BorshDeserialize for ChannelEnd
fn deserialize_reader<R>(reader: &mut R) -> Result<ChannelEnd, 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 ChannelEnd
impl BorshSerialize for ChannelEnd
source§impl Clone for ChannelEnd
impl Clone for ChannelEnd
source§fn clone(&self) -> ChannelEnd
fn clone(&self) -> ChannelEnd
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for ChannelEnd
impl Debug for ChannelEnd
source§impl Decode for ChannelEnd
impl Decode for ChannelEnd
source§fn decode<__CodecInputEdqy>(
__codec_input_edqy: &mut __CodecInputEdqy
) -> Result<ChannelEnd, Error>where
__CodecInputEdqy: Input,
fn decode<__CodecInputEdqy>(
__codec_input_edqy: &mut __CodecInputEdqy
) -> Result<ChannelEnd, 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 ChannelEnd
impl<'de> Deserialize<'de> for ChannelEnd
source§fn deserialize<__D>(
__deserializer: __D
) -> Result<ChannelEnd, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D
) -> Result<ChannelEnd, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl Display for ChannelEnd
impl Display for ChannelEnd
source§impl Encode for ChannelEnd
impl Encode for ChannelEnd
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 From<ChannelEnd> for Channel
impl From<ChannelEnd> for Channel
source§fn from(value: ChannelEnd) -> Channel
fn from(value: ChannelEnd) -> Channel
Converts to this type from the input type.
source§impl JsonSchema for ChannelEnd
impl JsonSchema for ChannelEnd
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 ChannelEnd
impl PartialEq for ChannelEnd
source§fn eq(&self, other: &ChannelEnd) -> bool
fn eq(&self, other: &ChannelEnd) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl Protobuf<Channel> for ChannelEnd
impl Protobuf<Channel> for ChannelEnd
source§fn encode<B>(self, buf: &mut B) -> Result<(), Error>where
B: BufMut,
fn encode<B>(self, buf: &mut B) -> Result<(), Error>where
B: BufMut,
Encode into a buffer in Protobuf format. Read more
source§fn encode_length_delimited<B>(self, buf: &mut B) -> Result<(), Error>where
B: BufMut,
fn encode_length_delimited<B>(self, buf: &mut B) -> Result<(), Error>where
B: BufMut,
Encode with a length-delimiter to a buffer in Protobuf format. Read more
source§fn decode<B>(buf: B) -> Result<Self, Error>where
B: Buf,
fn decode<B>(buf: B) -> Result<Self, Error>where
B: Buf,
Constructor that attempts to decode an instance from a buffer. Read more
source§fn decode_length_delimited<B>(buf: B) -> Result<Self, Error>where
B: Buf,
fn decode_length_delimited<B>(buf: B) -> Result<Self, Error>where
B: Buf,
Constructor that attempts to decode a length-delimited instance from
the buffer. Read more
source§fn encoded_len(self) -> usize
fn encoded_len(self) -> usize
Returns the encoded length of the message without a length delimiter. Read more
source§fn decode_vec(v: &[u8]) -> Result<Self, Error>
fn decode_vec(v: &[u8]) -> Result<Self, Error>
Constructor that attempts to decode a Protobuf-encoded instance from a
Vec<u8>
(or equivalent).source§impl Serialize for ChannelEnd
impl Serialize for ChannelEnd
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
source§impl TryFrom<Channel> for ChannelEnd
impl TryFrom<Channel> for ChannelEnd
§type Error = ChannelError
type Error = ChannelError
The type returned in the event of a conversion error.
source§fn try_from(
value: Channel
) -> Result<ChannelEnd, <ChannelEnd as TryFrom<Channel>>::Error>
fn try_from( value: Channel ) -> Result<ChannelEnd, <ChannelEnd as TryFrom<Channel>>::Error>
Performs the conversion.
source§impl TypeInfo for ChannelEnd
impl TypeInfo for ChannelEnd
impl EncodeLike for ChannelEnd
impl Eq for ChannelEnd
impl StructuralPartialEq for ChannelEnd
Auto Trait Implementations§
impl Freeze for ChannelEnd
impl RefUnwindSafe for ChannelEnd
impl Send for ChannelEnd
impl Sync for ChannelEnd
impl Unpin for ChannelEnd
impl UnwindSafe for ChannelEnd
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