Struct string_cache_codegen::AtomType [] [src]

pub struct AtomType { /* fields omitted */ }

A builder for a static atom set and relevant macros

Methods

impl AtomType
[src]

Constructs a new static atom set builder

path is a path within a crate of the atom type that will be created. e.g. "FooAtom" at the crate root or "foo::Atom" if the generated code is included in a foo module.

macro_name must end with !.

For example, AtomType::new("foo::FooAtom", "foo_atom!") will generate:

pub type FooAtom = ::string_cache::Atom<FooAtomStaticSet>;
pub struct FooAtomStaticSet;
impl ::string_cache::StaticAtomSet for FooAtomStaticSet {
    // ...
}
#[macro_export]
macro_rules foo_atom {
   // Expands to: $crate::foo::FooAtom { … }
}

Adds an atom to the builder

Adds multiple atoms to the builder

Write generated code to destination.

Create a new file at path and write generated code there.

Typical usage: .write_to_file(&Path::new(&env::var("OUT_DIR").unwrap()).join("foo_atom.rs"))