pub enum TypeSig {
Any,
Null,
Bool,
Int,
Float,
String,
Bytes,
List(Box<TypeSig>),
Map(Box<TypeSig>),
Named(String),
}Expand description
A structural type signature used for port compatibility checking.
Variants§
Any
Matches any other TypeSig. Use as a wildcard input or output.
Null
The null / absent type.
Bool
Boolean.
Int
64-bit signed integer.
Float
64-bit floating-point number.
String
UTF-8 string.
Bytes
Raw byte sequence.
List(Box<TypeSig>)
Homogeneous list of elements with the given element type.
Map(Box<TypeSig>)
Map with string keys and values of the given type.
Named(String)
A user-defined named type (e.g. a domain struct name).
Implementations§
Source§impl TypeSig
impl TypeSig
Sourcepub fn is_compatible_with(&self, other: &TypeSig) -> bool
pub fn is_compatible_with(&self, other: &TypeSig) -> bool
Returns true if a value with type signature self can be accepted
where other is expected.
Rules:
Anyis compatible with everything (in either position).Named(a)is compatible withNamed(b)iffa == b.List(a)is compatible withList(b)iffais compatible withb.Map(a)is compatible withMap(b)iffais compatible withb.- All other variants require exact equality.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for TypeSig
impl<'de> Deserialize<'de> for TypeSig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for TypeSig
impl StructuralPartialEq for TypeSig
Auto Trait Implementations§
impl Freeze for TypeSig
impl RefUnwindSafe for TypeSig
impl Send for TypeSig
impl Sync for TypeSig
impl Unpin for TypeSig
impl UnsafeUnpin for TypeSig
impl UnwindSafe for TypeSig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more