pub struct ExprType { /* private fields */ }Expand description
Implementations§
Source§impl ExprType
impl ExprType
pub const BOOL: ExprType
pub const INT: ExprType
pub const FLOAT: ExprType
pub const STRING: ExprType
pub const PATH: ExprType
pub const RANGE_EXPR: ExprType
pub const NULLTYPE: ExprType
pub const ANY: ExprType
pub const NORETURN: ExprType
pub const T: ExprType
pub const T1: ExprType
pub const T2: ExprType
pub const T3: ExprType
Sourcepub fn params(&self) -> &[ExprType]
pub fn params(&self) -> &[ExprType]
The type parameters (e.g. element type for lists, member types for unions).
pub fn list(elem: ExprType) -> Self
pub fn union(types: Vec<ExprType>) -> Self
pub fn unresolved(constraint: ExprType) -> Self
Sourcepub fn signature(param_types: Vec<ExprType>, return_type: ExprType) -> Self
pub fn signature(param_types: Vec<ExprType>, return_type: ExprType) -> Self
Create a function signature type: (param_types) -> return_type.
Stored as params = [param0, param1, …, return_type].
Sourcepub fn sig_params(&self) -> &[ExprType]
pub fn sig_params(&self) -> &[ExprType]
Get the parameter types of a signature (all params except the last).
Sourcepub fn sig_return(&self) -> &ExprType
pub fn sig_return(&self) -> &ExprType
Get the return type of a signature (the last param).
Sourcepub fn match_call(
&self,
arg_types: &[ExprType],
) -> Option<HashMap<TypeCode, ExprType>>
pub fn match_call( &self, arg_types: &[ExprType], ) -> Option<HashMap<TypeCode, ExprType>>
Try to match a call’s argument types against this signature. Returns type variable bindings if successful, None if no match.
Sourcepub fn resolve_call(&self, arg_types: &[ExprType]) -> Option<ExprType>
pub fn resolve_call(&self, arg_types: &[ExprType]) -> Option<ExprType>
Resolve the return type of a signature given argument types. Matches args, substitutes bindings into return type.
Source§impl ExprType
impl ExprType
pub fn is_list(&self) -> bool
pub fn list_element_type(&self) -> Option<&ExprType>
pub fn is_symbolic(&self) -> bool
pub fn is_concrete(&self) -> bool
Sourcepub fn substitute(&self, bindings: &HashMap<TypeCode, ExprType>) -> ExprType
pub fn substitute(&self, bindings: &HashMap<TypeCode, ExprType>) -> ExprType
Substitute type variables with concrete types.
Trait Implementations§
impl Eq for ExprType
Auto Trait Implementations§
impl Freeze for ExprType
impl RefUnwindSafe for ExprType
impl Send for ExprType
impl Sync for ExprType
impl Unpin for ExprType
impl UnsafeUnpin for ExprType
impl UnwindSafe for ExprType
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.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 moreSource§impl<T> ToCompactString for Twhere
T: Display,
impl<T> ToCompactString for Twhere
T: Display,
Source§fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
Fallible version of
ToCompactString::to_compact_string() Read moreSource§fn to_compact_string(&self) -> CompactString
fn to_compact_string(&self) -> CompactString
Converts the given value to a
CompactString. Read more