heck

Trait ToSnakeCase

Source
pub trait ToSnakeCase: ToOwned {
    // Required method
    fn to_snake_case(&self) -> Self::Owned;
}
Expand description

This trait defines a snake case conversion.

In snake_case, word boundaries are indicated by underscores.

§Example:

use heck::ToSnakeCase;

let sentence = "We carry a new world here, in our hearts.";
assert_eq!(sentence.to_snake_case(), "we_carry_a_new_world_here_in_our_hearts");

Required Methods§

Source

fn to_snake_case(&self) -> Self::Owned

Convert this type to snake case.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl ToSnakeCase for str

Implementors§