Skip to content

Emitter usage

  1. Via the command line
Terminal window
tsp compile . --emit=@azure-tools/typespec-rust
  1. Via the config
emit:
- "@azure-tools/typespec-rust"

The config can be extended with options as follows:

emit:
- "@azure-tools/typespec-rust"
options:
"@azure-tools/typespec-rust":
option: value

Type: absolutePath

Defines the emitter output directory. Defaults to {output-dir}/@azure-tools/typespec-rust. See Configuring output directory for more info

Type: string

Required

The name of the generated Rust crate as it appears in Cargo.toml.

Type: string

Required

The version string of the generated Rust crate as it appears in Cargo.toml (e.g. "0.1.0").

Type: boolean

Set to true to skip generating constructors and their associated options type for all client structs. Useful when constructors are hand-written in a client.tsp customization layer. The default value is false.

Type: boolean

Set to true to overwrite an existing Cargo.toml file in the output directory. By default the emitter skips re-generating Cargo.toml when one already exists, so that hand-edited dependency entries are preserved. The default value is false.

Type: boolean

Set to true to overwrite an existing lib.rs file in the output directory. By default the emitter skips re-generating lib.rs so that hand-written module declarations are preserved. The default value is false.

Type: boolean

Set to true to emit TryFrom trait implementations for terminal error types. This allows callers to convert a generic azure_core::Error into a strongly-typed error model. The default value is false.

Type: boolean

Set to true to omit intra-doc links in the generated Rust documentation comments. This is a temporary workaround for cases where the generated link targets are not yet resolvable by rustdoc. The default value is false.