Trait heck::SnakeCase

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

This trait defines a camel case conversion.

In snake_case, word boundaries are indicated by underscores.

§Example:

extern crate heck;
fn main() {

    use heck::SnakeCase;

    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.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl SnakeCase for str

Implementors§