pub struct EmitCtx {
pub local_types: HashMap<String, Type>,
pub rc_wrapped: HashSet<String>,
pub borrowed_params: HashSet<String>,
}Expand description
Emission context carrying Rust-specific type/borrow policy.
Fields§
§local_types: HashMap<String, Type>Local variable types (from fn params) for copy-type elision.
rc_wrapped: HashSet<String>Parameters passed as Rc<T> (self-TCO) or &T (mutual-TCO pass-through).
borrowed_params: HashSet<String>Parameters emitted as &T borrows (borrow-by-default for non-Copy, non-Str params).
Implementations§
Source§impl EmitCtx
impl EmitCtx
Sourcepub fn for_fn(param_types: HashMap<String, Type>) -> Self
pub fn for_fn(param_types: HashMap<String, Type>) -> Self
Build context for a function with known parameter types.
Automatically computes borrowed_params from param types.
Sourcepub fn for_fn_no_borrow(param_types: HashMap<String, Type>) -> Self
pub fn for_fn_no_borrow(param_types: HashMap<String, Type>) -> Self
Build context for a function WITHOUT borrow-by-default (e.g. TCO, memo).
Sourcepub fn is_copy(&self, name: &str) -> bool
pub fn is_copy(&self, name: &str) -> bool
Is this variable a Copy type in Rust (i64, f64, bool, ())?
Sourcepub fn is_rc_wrapped(&self, name: &str) -> bool
pub fn is_rc_wrapped(&self, name: &str) -> bool
Is this variable a pass-through parameter (Rc
Sourcepub fn is_borrowed_param(&self, name: &str) -> bool
pub fn is_borrowed_param(&self, name: &str) -> bool
Is this variable a borrowed parameter (&T from borrow-by-default)?
Sourcepub fn with_rc_wrapped(&self, rc: HashSet<String>) -> Self
pub fn with_rc_wrapped(&self, rc: HashSet<String>) -> Self
Create a context with specified Rc-wrapped parameters (TCO pass-through).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for EmitCtx
impl RefUnwindSafe for EmitCtx
impl Send for EmitCtx
impl Sync for EmitCtx
impl Unpin for EmitCtx
impl UnsafeUnpin for EmitCtx
impl UnwindSafe for EmitCtx
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