Trait svd2rust::util::ToSanitizedCase
source · pub trait ToSanitizedCase {
// Required methods
fn to_sanitized_pascal_case(&self) -> Cow<'_, str>;
fn to_sanitized_constant_case(&self) -> Cow<'_, str>;
fn to_sanitized_not_keyword_snake_case(&self) -> Cow<'_, str>;
// Provided methods
fn to_pascal_case_ident(&self, span: Span) -> Ident { ... }
fn to_constant_case_ident(&self, span: Span) -> Ident { ... }
fn to_sanitized_snake_case(&self) -> Cow<'_, str> { ... }
fn to_snake_case_ident(&self, span: Span) -> Ident { ... }
}
Expand description
Convert self string into specific case without overlapping to svd2rust internal names
Required Methods§
sourcefn to_sanitized_pascal_case(&self) -> Cow<'_, str>
fn to_sanitized_pascal_case(&self) -> Cow<'_, str>
Convert self into PascalCase.
Use on name of enumeration values.
sourcefn to_sanitized_constant_case(&self) -> Cow<'_, str>
fn to_sanitized_constant_case(&self) -> Cow<'_, str>
Convert self into CONSTANT_CASE.
Use on name of reader structs, writer structs and enumerations.
sourcefn to_sanitized_not_keyword_snake_case(&self) -> Cow<'_, str>
fn to_sanitized_not_keyword_snake_case(&self) -> Cow<'_, str>
Convert self into snake_case, must use only if the target is used with extra prefix or suffix.
Provided Methods§
fn to_pascal_case_ident(&self, span: Span) -> Ident
fn to_constant_case_ident(&self, span: Span) -> Ident
sourcefn to_sanitized_snake_case(&self) -> Cow<'_, str>
fn to_sanitized_snake_case(&self) -> Cow<'_, str>
Convert self into snake_case target and ensure target is not a Rust keyword.
If the sanitized target is a Rust keyword, this function adds an underline _
to it.
Use on name of peripheral modules, register modules and field modules.