mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-31 13:21:01 +00:00
Make debug display of LaneId compatible with its previous version (#1740)
* make {:?} of LaneId compatible with its previous version
* fmt
* apply review suggestions
This commit is contained in:
committed by
Bastian Köcher
parent
4a10ccb118
commit
f82372e818
@@ -69,21 +69,16 @@ impl OperatingMode for MessagesOperatingMode {
|
|||||||
|
|
||||||
/// Lane id which implements `TypeId`.
|
/// Lane id which implements `TypeId`.
|
||||||
#[derive(
|
#[derive(
|
||||||
Clone,
|
Clone, Copy, Decode, Default, Encode, Eq, Ord, PartialOrd, PartialEq, TypeInfo, MaxEncodedLen,
|
||||||
Copy,
|
|
||||||
Decode,
|
|
||||||
Default,
|
|
||||||
Encode,
|
|
||||||
Eq,
|
|
||||||
Ord,
|
|
||||||
PartialOrd,
|
|
||||||
PartialEq,
|
|
||||||
RuntimeDebug,
|
|
||||||
TypeInfo,
|
|
||||||
MaxEncodedLen,
|
|
||||||
)]
|
)]
|
||||||
pub struct LaneId(pub [u8; 4]);
|
pub struct LaneId(pub [u8; 4]);
|
||||||
|
|
||||||
|
impl core::fmt::Debug for LaneId {
|
||||||
|
fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
|
||||||
|
self.0.fmt(fmt)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl AsRef<[u8]> for LaneId {
|
impl AsRef<[u8]> for LaneId {
|
||||||
fn as_ref(&self) -> &[u8] {
|
fn as_ref(&self) -> &[u8] {
|
||||||
&self.0
|
&self.0
|
||||||
@@ -458,4 +453,9 @@ mod tests {
|
|||||||
assert!(delivered_messages.contains_message(150));
|
assert!(delivered_messages.contains_message(150));
|
||||||
assert!(!delivered_messages.contains_message(151));
|
assert!(!delivered_messages.contains_message(151));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn lane_id_debug_format_matches_inner_array_format() {
|
||||||
|
assert_eq!(format!("{:?}", LaneId([0, 0, 0, 0])), format!("{:?}", [0, 0, 0, 0]),);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user