pub struct AtomType { /* private fields */ }
Expand description

A builder for a static atom set and relevant macros

Implementations

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 { … }
}

Add some documentation to the generated Atom type alias.

This can help the user know that the type uses interned strings.

Note that docs should not contain the /// at the front of normal docs.

Add some documentation to the generated static set.

This can help the user know that this type is zero-sized and just references a static lookup table, or point them to the Atom type alias for more info.

Note that docs should not contain the /// at the front of normal docs.

Add some documentation to the generated macro.

Note that docs should not contain the /// at the front of normal docs.

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"))

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.