mirror of
https://github.com/fluencelabs/interface-types
synced 2025-06-27 21:51:39 +00:00
feat(interface-types) Add the Vec1
type to represent a non-empty vector.
`Vec1` is used by `RecordType` to ensure that a record have at least 1 field. Then an `InterfaceValue::Record` is ensured to get at least one value with the type-checking pass.
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
//! Represents the WIT language as a tree. This is the central
|
||||
//! representation of the language.
|
||||
|
||||
use crate::interpreter::Instruction;
|
||||
use crate::{interpreter::Instruction, vec1::Vec1};
|
||||
use std::str;
|
||||
|
||||
/// Represents the types supported by WIT.
|
||||
@ -57,7 +57,7 @@ pub enum InterfaceType {
|
||||
#[derive(PartialEq, Debug, Clone)]
|
||||
pub struct RecordType {
|
||||
/// Types representing the fields.
|
||||
pub fields: Vec<InterfaceType>,
|
||||
pub fields: Vec1<InterfaceType>,
|
||||
}
|
||||
|
||||
/// Represents the kind of type.
|
||||
|
Reference in New Issue
Block a user