pub struct ExplicitNaming { /* private fields */ }Expand description
A more explicit version of Naming that does not add or
remove any suffixes or prefixes from the generated name expect the one that
were configured by Generator::with_type_postfix.
This may result in repeated string inside the generated names (like
FooTypeType), but will reduce naming conflicts in most cases.
Implementations§
Source§impl ExplicitNaming
impl ExplicitNaming
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a new ExplicitNaming instance.
Sourcepub fn unify_names(self, value: bool) -> Self
pub fn unify_names(self, value: bool) -> Self
Set whether to unify names the names for all types or not.
Unifying names means that all names will be expressed as pascal case to match the naming convention for types in Rust. This may lead to naming conflicts.
Default is true.
Sourcepub fn with_element_field_postfix<S: Into<String>>(self, postfix: S) -> Self
pub fn with_element_field_postfix<S: Into<String>>(self, postfix: S) -> Self
Set the postfix to add to generated element field names.
This can be useful to avoid naming conflicts between element and attribute fields.
Sourcepub fn with_attribute_field_postfix<S: Into<String>>(self, postfix: S) -> Self
pub fn with_attribute_field_postfix<S: Into<String>>(self, postfix: S) -> Self
Set the postfix to add to generated attribute field names.
This can be useful to avoid naming conflicts between element and attribute fields.
Trait Implementations§
Source§impl Clone for ExplicitNaming
impl Clone for ExplicitNaming
Source§fn clone(&self) -> ExplicitNaming
fn clone(&self) -> ExplicitNaming
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ExplicitNaming
impl Debug for ExplicitNaming
Source§impl Default for ExplicitNaming
impl Default for ExplicitNaming
Source§impl Naming for ExplicitNaming
impl Naming for ExplicitNaming
Source§fn clone_boxed(&self) -> Box<dyn NamingTrait>
fn clone_boxed(&self) -> Box<dyn NamingTrait>
Box.Source§fn builder(&self) -> Box<dyn NameBuilderTrait>
fn builder(&self) -> Box<dyn NameBuilderTrait>
Source§fn make_type_name(
&self,
postfixes: &[String],
ty: &MetaType,
ident: &TypeIdent,
) -> Name
fn make_type_name( &self, postfixes: &[String], ty: &MetaType, ident: &TypeIdent, ) -> Name
ty identified by ident respecting the
configured type postfixes.Source§fn make_unknown_variant(&self, id: usize) -> Ident2
fn make_unknown_variant(&self, id: usize) -> Ident2
Source§fn format_module_name(&self, s: &str) -> String
fn format_module_name(&self, s: &str) -> String
s as module name.Source§fn format_type_name(&self, s: &str) -> String
fn format_type_name(&self, s: &str) -> String
s as type name.Source§fn format_field_name(&self, s: &str) -> String
fn format_field_name(&self, s: &str) -> String
s as field name.Source§fn format_variant_name(&self, s: &str) -> String
fn format_variant_name(&self, s: &str) -> String
s as variant name.Source§fn format_constant_name(&self, s: &str) -> String
fn format_constant_name(&self, s: &str) -> String
s as constant name.Source§fn format_element_field_name(&self, s: &str) -> String
fn format_element_field_name(&self, s: &str) -> String
s as element field name. Read moreSource§fn format_attribute_field_name(&self, s: &str) -> String
fn format_attribute_field_name(&self, s: &str) -> String
s as attribute field name. Read moreSource§fn format_module_ident(&self, name: &Name) -> Ident2
fn format_module_ident(&self, name: &Name) -> Ident2
name. Read moreSource§fn format_type_ident(&self, name: &Name, display_name: Option<&str>) -> Ident2
fn format_type_ident(&self, name: &Name, display_name: Option<&str>) -> Ident2
name respecting
user defined names stored in display_name. Read moreSource§fn format_field_ident(&self, name: &Name, display_name: Option<&str>) -> Ident2
fn format_field_ident(&self, name: &Name, display_name: Option<&str>) -> Ident2
name respecting
user defined names stored in display_name. Read moreSource§fn format_variant_ident(
&self,
name: &Name,
display_name: Option<&str>,
) -> Ident2
fn format_variant_ident( &self, name: &Name, display_name: Option<&str>, ) -> Ident2
name respecting
user defined names stored in display_name. Read moreSource§fn format_constant_ident(
&self,
name: &Name,
display_name: Option<&str>,
) -> Ident2
fn format_constant_ident( &self, name: &Name, display_name: Option<&str>, ) -> Ident2
name respecting
user defined names stored in display_name. Read moreSource§fn format_attribute_field_ident(
&self,
name: &Name,
display_name: Option<&str>,
) -> Ident2
fn format_attribute_field_ident( &self, name: &Name, display_name: Option<&str>, ) -> Ident2
name
respecting user defined names stored in display_name. Read moreSource§fn format_element_field_ident(
&self,
name: &Name,
display_name: Option<&str>,
) -> Ident2
fn format_element_field_ident( &self, name: &Name, display_name: Option<&str>, ) -> Ident2
name
respecting user defined names stored in display_name. Read moreSource§fn format_module(
&self,
types: &MetaTypes,
ns: Option<NamespaceId>,
) -> Option<Ident2>
fn format_module( &self, types: &MetaTypes, ns: Option<NamespaceId>, ) -> Option<Ident2>
ns.