pub struct TypeScriptBackend;Expand description
TypeScript code generation backend.
Wraps the existing TypeScript emitters and implements the language-agnostic
CodegenBackend trait, enabling generate_all to be called generically.
Trait Implementations§
Source§impl CodegenBackend for TypeScriptBackend
impl CodegenBackend for TypeScriptBackend
Source§fn map_type(&self, capnp_type: &str) -> String
fn map_type(&self, capnp_type: &str) -> String
Map a Cap’n Proto type name to the target language’s type. Read more
Source§fn setter_method(&self, type_name: &str) -> Option<String>
fn setter_method(&self, type_name: &str) -> Option<String>
Return the setter method name on a builder for this type, if the runtime
supports a direct method call. Returns
None for types handled specially
(struct pointers, enum ordinals, etc.).Source§fn getter_expr(&self, reader_var: &str, field: &FieldDef) -> String
fn getter_expr(&self, reader_var: &str, field: &FieldDef) -> String
Return an expression that reads a field’s value from a reader variable.
Source§fn default_value(&self, type_name: &str) -> String
fn default_value(&self, type_name: &str) -> String
Return the default value expression for a type (used for optional field coalescing).
Source§fn generate_service_file(
&self,
service_name: &str,
schema: &ParsedSchema,
) -> String
fn generate_service_file( &self, service_name: &str, schema: &ParsedSchema, ) -> String
Generate the complete source file content for a service schema.
Source§fn runtime_file(&self) -> (String, String)
fn runtime_file(&self) -> (String, String)
Return
(filename, content) for the shared runtime file included in all output. Read moreSource§fn file_extension(&self) -> &str
fn file_extension(&self) -> &str
Return the file extension for generated service files (e.g.,
"ts", "py").Auto Trait Implementations§
impl Freeze for TypeScriptBackend
impl RefUnwindSafe for TypeScriptBackend
impl Send for TypeScriptBackend
impl Sync for TypeScriptBackend
impl Unpin for TypeScriptBackend
impl UnsafeUnpin for TypeScriptBackend
impl UnwindSafe for TypeScriptBackend
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