Skip to main content

type_renames

Function type_renames 

Source
pub fn type_renames(spec: &Spec, suffix: Option<&str>) -> Result<TypeNames>
Expand description

Resolve the Rust type name of every top-level schema in spec.

Two distinct schema names can collapse onto one Rust identifier. For example, foo-bar and fooBar both become FooBar. When suffix is set, the second name takes the suffix. When suffix is None, the collision is recorded in the returned TypeNames for the caller to report, because the generator will not choose a name for one of two distinct schemas. That choice belongs to the author.

ยงErrors

A suffix that contributes no characters to an identifier is an error. Casing removes punctuation, so a suffix such as - leaves the name unchanged and cannot resolve a collision. A valid suffix holds a letter or a digit.