xxx: Backup

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
This commit is contained in:
Alexandru Vasile
2023-05-25 09:53:21 +03:00
parent 534e0e472d
commit 85f7575682
2 changed files with 44 additions and 15 deletions
+31
View File
@@ -507,15 +507,46 @@ pub enum FollowEvent<Hash> {
/// The result of a chain head method.
#[derive(Debug, Clone, PartialEq, Eq, Deserialize)]
#[serde(rename_all = "camelCase")]
#[cfg(feature = "experimental-light-client")]
#[serde(try_from = "LightClientChainHeadResult<T>")]
pub struct ChainHeadResult<T> {
/// Result of the method.
#[cfg(not(feature = "experimental-light-client"))]
pub result: T,
/// Result of the method.
///
/// # Note
///
/// `chainHead_body` returns a vector of values, while
/// `chainHead_storage` returns just one plain element.
#[cfg(feature = "experimental-light-client")]
pub value: Vec<T>,
}
/// The result of a chain head method.
#[derive(Debug, Clone, PartialEq, Eq, Deserialize)]
#[serde(rename_all = "camelCase")]
#[cfg(feature = "experimental-light-client")]
pub struct LightClientChainHeadResult<T> {
/// Result of the method.
///
/// # Note
///
/// `chainHead_body` returns a vector of values, while
/// `chainHead_storage` returns just one plain element.
pub value: T,
}
impl<T> TryFrom<LightClientChainHeadResult<T>> for ChainHeadResult<T> {
type Error = &'static str;
fn try_from(light: LightClientChainHeadResult<T>) -> Result<Self, &'static str> {
Ok(Self {
value: vec![light.value],
})
}
}
/// The event generated by the body / call / storage methods.
#[derive(Debug, Clone, PartialEq, Eq, Deserialize)]
#[serde(rename_all = "camelCase")]