-
Notifications
You must be signed in to change notification settings - Fork 109
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
…#387) * move ArrayType to own file * move MapType to own file * move ArrayValue to own file * move MapValue to own file
- Loading branch information
Showing
13 changed files
with
517 additions
and
493 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
use crate::algebraic_type::AlgebraicType; | ||
use crate::de::Deserialize; | ||
use crate::meta_type::MetaType; | ||
use crate::{impl_deserialize, impl_serialize}; | ||
|
||
/// An array type is a homegeneous product type of dynamic length. | ||
/// | ||
/// That is, it is a product type | ||
/// where every element / factor / field is of the same type | ||
/// and where the length is statically unknown. | ||
#[derive(Debug, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)] | ||
pub struct ArrayType { | ||
/// The base type every element of the array has. | ||
pub elem_ty: Box<AlgebraicType>, | ||
} | ||
|
||
impl_serialize!([] ArrayType, (self, ser) => self.elem_ty.serialize(ser)); | ||
impl_deserialize!([] ArrayType, de => Deserialize::deserialize(de).map(|elem_ty| Self { elem_ty })); | ||
|
||
impl MetaType for ArrayType { | ||
fn meta_type() -> AlgebraicType { | ||
AlgebraicType::ZERO_REF | ||
} | ||
} |
Oops, something went wrong.