mirror of
https://github.com/fluencelabs/interface-types
synced 2024-12-04 15:20:20 +00:00
Add Serialize/Deserialize for InterfaceType, RecordType and Vec1
This commit is contained in:
parent
567bec274b
commit
add53640f1
@ -1,9 +1,10 @@
|
||||
//! This module defines the WIT types.
|
||||
|
||||
use crate::vec1::Vec1;
|
||||
use serde::{Serialize, Deserialize};
|
||||
|
||||
/// Represents the types supported by WIT.
|
||||
#[derive(PartialEq, Debug, Clone)]
|
||||
#[derive(PartialEq, Debug, Clone, Serialize, Deserialize)]
|
||||
pub enum InterfaceType {
|
||||
/// A 8-bits signed integer.
|
||||
S8,
|
||||
@ -52,7 +53,7 @@ pub enum InterfaceType {
|
||||
}
|
||||
|
||||
/// Represents a record type.
|
||||
#[derive(PartialEq, Debug, Clone)]
|
||||
#[derive(PartialEq, Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct RecordType {
|
||||
/// Types representing the fields.
|
||||
/// A record must have at least one field, hence the
|
||||
|
@ -5,10 +5,11 @@ use std::{
|
||||
fmt::{self, Debug},
|
||||
ops,
|
||||
};
|
||||
use serde::{Serialize, Deserialize};
|
||||
|
||||
/// `Vec1<T>` represents a non-empty `Vec<T>`. It derefs to `Vec<T>`
|
||||
/// directly.
|
||||
#[derive(Clone, PartialEq)]
|
||||
#[derive(Clone, PartialEq, Serialize, Deserialize)]
|
||||
pub struct Vec1<T>(Vec<T>)
|
||||
where
|
||||
T: Debug;
|
||||
|
Loading…
Reference in New Issue
Block a user