use crate::{Addr, Bytes, UnionType};
pub trait Val<A> {
type E;
fn alloc_env(&mut self, r: Addr) -> bool;
fn set_env(&mut self, r: Addr, v: Self::E);
fn prim_v(&self, ty: &str, val: &[u8]) -> Self::E;
fn bytes_v(&self, ty: &str, val: Bytes) -> Self::E;
fn arr_v<I: Iterator<Item = Self::E>>(&self, iter: I) -> Self::E;
fn ref_v(&self, ty: &str, r: Addr) -> Self::E;
fn struct_v<I: Iterator<Item = (String, Self::E)>>(&self, ty: &str, fields: I) -> Self::E;
fn enumerate_v(&self, ty: &str, variant: &str) -> Self::E;
fn unit_v(&self) -> Self::E;
fn opaque_v(&self) -> Self::E;
}
pub trait RVal<A>: Val<A> {
fn strlit_v(&self, val: &[u8]) -> Self::E;
fn union_v<I: Iterator<Item = (String, Self::E)>>(
&mut self,
t: &UnionType,
index: usize,
fields: I,
) -> Self::E;
fn vector_v<I: Iterator<Item = Self::E>>(&self, iter: I) -> Self::E;
fn slice_v<I: Iterator<Item = Self::E>>(&self, iter: I) -> Self::E;
}