pub enum TypeDef {
Regular {
source_location: Source,
name: String,
parent: String,
overrides: Option<Vec<(String, Vec<String>)>>,
},
Import {
source_location: Source,
name: String,
source_type: String,
from: String,
overrides: Option<Vec<(String, Vec<String>)>>,
},
Inline {
source_location: Source,
parent: String,
overrides: Option<Vec<(String, Vec<String>)>>,
fact_ref: FactReference,
from: Option<String>,
},
}Expand description
User-defined type as it appears in the source (AST)
Supports these variants:
- Basic type:
type money = number - Basic type extension:
type money = number -> decimals 2 -> unit EUR 1.00 -> unit USD 1.18 - From another custom type:
type currency from lemma - Shorthand with overrides:
type currency from lemma -> maximum 1000 - Inline type definitions:
fact age = [number -> minimum 0 -> maximum 120]
Variants§
Regular
Regular named type definition
Example: type money = number -> decimals 2
Fields
Import
Imported type from another document
Example: type currency from lemma or type currency from lemma -> maximum 1000
Fields
Inline
Inline type definition
Example: fact age = [number -> minimum 0 -> maximum 120]
Example: fact age = [age from lemma]
Example: fact age = [age from lemma -> minimum 18]
Implementations§
Trait Implementations§
impl StructuralPartialEq for TypeDef
Auto Trait Implementations§
impl Freeze for TypeDef
impl RefUnwindSafe for TypeDef
impl Send for TypeDef
impl Sync for TypeDef
impl Unpin for TypeDef
impl UnwindSafe for TypeDef
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more