Features
- String Manipulation: Case conversion utilities for various naming conventions
- Syntax Processing: Helper utilities for working with Rust syntax trees
- Proc Macro Support: Tools for building procedural macros
Installation
Addbomboni_core to your Cargo.toml:
String Utilities
Thestring module provides utilities for converting strings between different case conventions.
Case Conversion
Convert strings to various case formats:Supported Case Types
TheCase enum from the convert_case crate provides many case conversion options:
Snake Case
my_variable_nameCamel Case
myVariableNamePascal Case
MyVariableNameKebab Case
my-variable-nameScreaming Snake
MY_VARIABLE_NAMETitle Case
My Variable NameBoundary Detection
The string conversion utilities intelligently detect word boundaries based on:- Underscores (
_) - Hyphens (
-) - Spaces
- Lower-to-upper case transitions
- Acronyms
- Upper-to-digit transitions
- Digit-to-upper transitions
- Digit-to-lower transitions
Syntax Processing Utilities
Thesyn module provides utilities for working with Rust syntax trees in procedural macros.
Type Checking Utilities
Check if a type matches common patterns:The type checking functions only examine the last segment of the type path, so they work with both fully qualified and simple type names.
Documentation Comment Formatting
Theformat_comment! macro helps generate documentation comments in procedural macros:
Usage in Procedural Macros
These utilities are designed to be used in procedural macros:API Reference
String Module
Converts a string to the specified case format.Parameters:
s: impl AsRef<str>- The string to convertcase: Case- The target case format
Enum representing different case formats. Re-exported from
convert_case crate.Common variants:Case::Snake- snake_caseCase::Camel- camelCaseCase::Pascal- PascalCaseCase::Kebab- kebab-caseCase::ScreamingSnake- SCREAMING_SNAKE_CASECase::Title- Title Case
Syn Module
Checks if a type is
PhantomData.Parameters:ty: &Type- The type to check
true if the type is PhantomDataChecks if a type is
Option.Parameters:ty: &Type- The type to check
true if the type is OptionGenerates a formatted documentation comment for use in procedural macros.Syntax:
format_comment!($fmt, $($arg)*)Returns: Token stream containing #[doc = "..."] attributeRelated Modules
bomboni_common
Common utilities and types
bomboni_macros
Convenient utility macros