pub struct BeamTypeCtx { /* private fields */ }Expand description
A lightweight type-checking context for BEAM expressions.
This performs best-effort type inference for documentation purposes.
Implementations§
Source§impl BeamTypeCtx
impl BeamTypeCtx
Sourcepub fn register_fun(
&mut self,
name: impl Into<String>,
params: Vec<BeamType>,
ret: BeamType,
)
pub fn register_fun( &mut self, name: impl Into<String>, params: Vec<BeamType>, ret: BeamType, )
Register a function’s type signature.
Sourcepub fn infer(&self, expr: &BeamExpr) -> BeamType
pub fn infer(&self, expr: &BeamExpr) -> BeamType
Infer the type of a BeamExpr (returns Any when unknown).
Sourcepub fn merge(&self, other: &BeamTypeCtx) -> BeamTypeCtx
pub fn merge(&self, other: &BeamTypeCtx) -> BeamTypeCtx
Merge another context (e.g., from two branches).
Trait Implementations§
Source§impl Clone for BeamTypeCtx
impl Clone for BeamTypeCtx
Source§fn clone(&self) -> BeamTypeCtx
fn clone(&self) -> BeamTypeCtx
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for BeamTypeCtx
impl Debug for BeamTypeCtx
Source§impl Default for BeamTypeCtx
impl Default for BeamTypeCtx
Source§fn default() -> BeamTypeCtx
fn default() -> BeamTypeCtx
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for BeamTypeCtx
impl RefUnwindSafe for BeamTypeCtx
impl Send for BeamTypeCtx
impl Sync for BeamTypeCtx
impl Unpin for BeamTypeCtx
impl UnsafeUnpin for BeamTypeCtx
impl UnwindSafe for BeamTypeCtx
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