pub trait TypeMapper {
Show 14 methods
// Required method
fn error_wrapper(&self) -> &str;
// Provided methods
fn primitive(&self, prim: &PrimitiveType) -> Cow<'static, str> { ... }
fn string(&self) -> Cow<'static, str> { ... }
fn bytes(&self) -> Cow<'static, str> { ... }
fn path(&self) -> Cow<'static, str> { ... }
fn json(&self) -> Cow<'static, str> { ... }
fn unit(&self) -> Cow<'static, str> { ... }
fn duration(&self) -> Cow<'static, str> { ... }
fn optional(&self, inner: &str) -> String { ... }
fn vec(&self, inner: &str) -> String { ... }
fn map(&self, key: &str, value: &str) -> String { ... }
fn named<'a>(&self, name: &'a str) -> Cow<'a, str> { ... }
fn map_type(&self, ty: &TypeRef) -> String { ... }
fn wrap_return(&self, base: &str, has_error: bool) -> String { ... }
}Expand description
Trait for mapping IR types to language-specific type strings. Backends implement only what differs from the Rust default.
Required Methods§
Sourcefn error_wrapper(&self) -> &str
fn error_wrapper(&self) -> &str
The error wrapper type for this language. e.g. “PyResult”, “napi::Result”, “PhpResult”
Provided Methods§
Sourcefn primitive(&self, prim: &PrimitiveType) -> Cow<'static, str>
fn primitive(&self, prim: &PrimitiveType) -> Cow<'static, str>
Map a primitive type. Default: Rust type names.
Sourcefn wrap_return(&self, base: &str, has_error: bool) -> String
fn wrap_return(&self, base: &str, has_error: bool) -> String
Wrap a return type with error handling if needed.