Remove Unwrappable (#7415)

* Remove

* rm trait
This commit is contained in:
Gavin Wood
2023-06-25 13:46:31 +02:00
committed by GitHub
parent 866aa1e8d4
commit 35413b4657
3 changed files with 3 additions and 23 deletions
+2 -2
View File
@@ -49,7 +49,7 @@ pub use multilocation::{
}; };
pub use traits::{ pub use traits::{
send_xcm, validate_send, Error, ExecuteXcm, Outcome, PreparedMessage, Result, SendError, send_xcm, validate_send, Error, ExecuteXcm, Outcome, PreparedMessage, Result, SendError,
SendResult, SendXcm, Unwrappable, Weight, XcmHash, SendResult, SendXcm, Weight, XcmHash,
}; };
// These parts of XCM v2 are unchanged in XCM v3, and are re-imported here. // These parts of XCM v2 are unchanged in XCM v3, and are re-imported here.
pub use super::v2::OriginKind; pub use super::v2::OriginKind;
@@ -184,7 +184,7 @@ pub mod prelude {
NetworkId::{self, *}, NetworkId::{self, *},
OriginKind, Outcome, PalletInfo, Parent, ParentThen, PreparedMessage, QueryId, OriginKind, Outcome, PalletInfo, Parent, ParentThen, PreparedMessage, QueryId,
QueryResponseInfo, Response, Result as XcmResult, SendError, SendResult, SendXcm, QueryResponseInfo, Response, Result as XcmResult, SendError, SendResult, SendXcm,
Unwrappable, Weight, Weight,
WeightLimit::{self, *}, WeightLimit::{self, *},
WildFungibility::{self, Fungible as WildFungible, NonFungible as WildNonFungible}, WildFungibility::{self, Fungible as WildFungible, NonFungible as WildNonFungible},
WildMultiAsset::{self, *}, WildMultiAsset::{self, *},
-20
View File
@@ -437,26 +437,6 @@ pub type XcmHash = [u8; 32];
/// Result value when attempting to send an XCM message. /// Result value when attempting to send an XCM message.
pub type SendResult<T> = result::Result<(T, MultiAssets), SendError>; pub type SendResult<T> = result::Result<(T, MultiAssets), SendError>;
pub trait Unwrappable {
type Inner;
fn none() -> Self;
fn some(i: Self::Inner) -> Self;
fn take(self) -> Option<Self::Inner>;
}
impl<T> Unwrappable for Option<T> {
type Inner = T;
fn none() -> Self {
None
}
fn some(i: Self::Inner) -> Self {
Some(i)
}
fn take(self) -> Option<Self::Inner> {
self
}
}
/// Utility for sending an XCM message to a given location. /// Utility for sending an XCM message to a given location.
/// ///
/// These can be amalgamated in tuples to form sophisticated routing systems. In tuple format, each /// These can be amalgamated in tuples to form sophisticated routing systems. In tuple format, each
@@ -97,7 +97,7 @@ impl ExportXcm for Tuple {
} }
} }
fn deliver(one_ticket: Self::Ticket) -> Result<XcmHash, SendError> { fn deliver(mut one_ticket: Self::Ticket) -> Result<XcmHash, SendError> {
for_tuples!( #( for_tuples!( #(
if let Some(validated) = one_ticket.Tuple.take() { if let Some(validated) = one_ticket.Tuple.take() {
return Tuple::deliver(validated); return Tuple::deliver(validated);