Skip to content

Commit

Permalink
impl Deserialize
Browse files Browse the repository at this point in the history
  • Loading branch information
osipov-mit committed Oct 23, 2024
1 parent 27a8e0b commit b6dfeac
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion core/src/buffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ use scale_info::{
/// `E` is overflow error type.
/// `N` is max len which a vector can have.
#[derive(Clone, Default, Eq, Hash, Ord, PartialEq, PartialOrd, Decode, Encode, TypeInfo)]
#[cfg_attr(feature = "std", derive(serde::Serialize))]
#[cfg_attr(feature = "std", derive(serde::Serialize, serde:Deserialize))]
pub struct LimitedVec<T, E, const N: usize>(Vec<T>, PhantomData<E>);

/// Formatter for [`LimitedVec`] will print to precision of 8 by default, to print the whole data, use `{:+}`.
Expand Down
6 changes: 3 additions & 3 deletions core/src/message/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ impl Message {
TypeInfo,
derive_more::From,
)]
#[cfg_attr(feature = "std", derive(serde::Serialize))]
#[cfg_attr(feature = "std", derive(serde::Serialize, serde:Deserialize))]
pub enum MessageDetails {
/// Reply details.
Reply(ReplyDetails),
Expand Down Expand Up @@ -229,7 +229,7 @@ impl MessageDetails {
#[derive(
Clone, Copy, Default, Debug, Eq, Hash, Ord, PartialEq, PartialOrd, Decode, Encode, TypeInfo,
)]
#[cfg_attr(feature = "std", derive(serde::Serialize))]
#[cfg_attr(feature = "std", derive(serde::Serialize, serde:Deserialize))]
pub struct ReplyDetails {
/// Message id, this message replies on.
to: MessageId,
Expand Down Expand Up @@ -263,7 +263,7 @@ impl ReplyDetails {
#[derive(
Clone, Copy, Default, Debug, Eq, Hash, Ord, PartialEq, PartialOrd, Decode, Encode, TypeInfo,
)]
#[cfg_attr(feature = "std", derive(serde::Serialize))]
#[cfg_attr(feature = "std", derive(serde::Serialize, serde:Deserialize))]
pub struct SignalDetails {
/// Message id, which issues signal.
to: MessageId,
Expand Down
2 changes: 1 addition & 1 deletion core/src/message/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ impl ContextOutcome {

/// Store of previous message execution context.
#[derive(Clone, Default, Debug, Eq, Hash, Ord, PartialEq, PartialOrd, Decode, Encode, TypeInfo)]
#[cfg_attr(feature = "std", derive(serde::Serialize))]
#[cfg_attr(feature = "std", derive(serde::Serialize, serde:Deserialize))]
pub struct ContextStore {
outgoing: BTreeMap<u32, Option<Payload>>,
reply: Option<Payload>,
Expand Down
4 changes: 2 additions & 2 deletions core/src/message/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ const _: () = assert!(MAX_PAYLOAD_SIZE <= u32::MAX as usize);
#[derive(
Clone, Copy, Default, Debug, Eq, Hash, Ord, PartialEq, PartialOrd, Decode, Encode, TypeInfo,
)]
#[cfg_attr(feature = "std", derive(serde::Serialize))]
#[cfg_attr(feature = "std", derive(serde::Serialize, serde:Deserialize))]
pub struct PayloadSizeError;

impl From<PayloadSizeError> for &str {
Expand Down Expand Up @@ -114,7 +114,7 @@ pub enum MessageWaitedType {
#[derive(
Copy, Clone, Default, Debug, Eq, Hash, Ord, PartialEq, PartialOrd, Decode, Encode, TypeInfo,
)]
#[cfg_attr(feature = "std", derive(serde::Serialize))]
#[cfg_attr(feature = "std", derive(serde::Serialize, serde:Deserialize))]
pub enum DispatchKind {
/// Initialization.
Init,
Expand Down
2 changes: 1 addition & 1 deletion core/src/pages.rs
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ impl<const SIZE: u32> PartialOrd<PagesAmount<SIZE>> for Page<SIZE> {
Default,
derive_more::Into,
)]
#[cfg_attr(feature = "std", derive(serde::Serialize))]
#[cfg_attr(feature = "std", derive(serde::Serialize, serde:Deserialize))]
pub struct Page<const SIZE: u32>(u32);

impl<const SIZE: u32> Page<SIZE> {
Expand Down
2 changes: 1 addition & 1 deletion core/src/program.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ pub enum ProgramState {

/// Struct defines infix of memory pages storage.
#[derive(Clone, Copy, Debug, Default, Decode, Encode, PartialEq, Eq, TypeInfo)]
#[cfg_attr(feature = "std", derive(serde::Serialize))]
#[cfg_attr(feature = "std", derive(serde::Serialize, serde:Deserialize))]
pub struct MemoryInfix(u32);

impl MemoryInfix {
Expand Down
2 changes: 1 addition & 1 deletion core/src/reservation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ use scale_info::{
#[derive(
Clone, Copy, Default, Debug, Eq, Hash, Ord, PartialEq, PartialOrd, Decode, Encode, TypeInfo,
)]
#[cfg_attr(feature = "std", derive(serde::Serialize))]
#[cfg_attr(feature = "std", derive(serde::Serialize, serde:Deserialize))]
pub struct ReservationNonce(u64);

impl From<&InnerNonce> for ReservationNonce {
Expand Down

0 comments on commit b6dfeac

Please sign in to comment.