Trait databake::Bake

source ·
pub trait Bake {
    // Required method
    fn bake(&self, ctx: &CrateEnv) -> TokenStream;
}
Expand description

The Bake trait allows a piece of data to write itself into a Rust expression.

This can be used to generate files with hardcoded data.

Required Methods§

source

fn bake(&self, ctx: &CrateEnv) -> TokenStream

Returns a TokenStream that would evaluate to self.

Crates that are required for the evaluation of the TokenStream will be added to ctx.

Implementations on Foreign Types§

source§

impl Bake for &str

source§

impl Bake for bool

source§

impl Bake for char

source§

impl Bake for f32

source§

impl Bake for f64

source§

impl Bake for i8

source§

impl Bake for i16

source§

impl Bake for i32

source§

impl Bake for i64

source§

impl Bake for i128

source§

impl Bake for isize

source§

impl Bake for u8

source§

impl Bake for u16

source§

impl Bake for u32

source§

impl Bake for u64

source§

impl Bake for u128

source§

impl Bake for ()

source§

fn bake(&self, _ctx: &CrateEnv) -> TokenStream

source§

impl Bake for usize

source§

impl Bake for String

source§

impl<A> Bake for (A,)
where A: Bake,

source§

fn bake(&self, ctx: &CrateEnv) -> TokenStream

source§

impl<A, B> Bake for (A, B)
where A: Bake, B: Bake,

source§

fn bake(&self, _ctx: &CrateEnv) -> TokenStream

source§

impl<A, B, C> Bake for (A, B, C)
where A: Bake, B: Bake, C: Bake,

source§

fn bake(&self, _ctx: &CrateEnv) -> TokenStream

source§

impl<A, B, C, D> Bake for (A, B, C, D)
where A: Bake, B: Bake, C: Bake, D: Bake,

source§

fn bake(&self, _ctx: &CrateEnv) -> TokenStream

source§

impl<A, B, C, D, E> Bake for (A, B, C, D, E)
where A: Bake, B: Bake, C: Bake, D: Bake, E: Bake,

source§

fn bake(&self, _ctx: &CrateEnv) -> TokenStream

source§

impl<A, B, C, D, E, F> Bake for (A, B, C, D, E, F)
where A: Bake, B: Bake, C: Bake, D: Bake, E: Bake, F: Bake,

source§

fn bake(&self, _ctx: &CrateEnv) -> TokenStream

source§

impl<A, B, C, D, E, F, G> Bake for (A, B, C, D, E, F, G)
where A: Bake, B: Bake, C: Bake, D: Bake, E: Bake, F: Bake, G: Bake,

source§

fn bake(&self, _ctx: &CrateEnv) -> TokenStream

source§

impl<A, B, C, D, E, F, G, H> Bake for (A, B, C, D, E, F, G, H)
where A: Bake, B: Bake, C: Bake, D: Bake, E: Bake, F: Bake, G: Bake, H: Bake,

source§

fn bake(&self, _ctx: &CrateEnv) -> TokenStream

source§

impl<A, B, C, D, E, F, G, H, I> Bake for (A, B, C, D, E, F, G, H, I)
where A: Bake, B: Bake, C: Bake, D: Bake, E: Bake, F: Bake, G: Bake, H: Bake, I: Bake,

source§

fn bake(&self, _ctx: &CrateEnv) -> TokenStream

source§

impl<A, B, C, D, E, F, G, H, I, J> Bake for (A, B, C, D, E, F, G, H, I, J)
where A: Bake, B: Bake, C: Bake, D: Bake, E: Bake, F: Bake, G: Bake, H: Bake, I: Bake, J: Bake,

source§

fn bake(&self, _ctx: &CrateEnv) -> TokenStream

source§

impl<K, V> Bake for BTreeMap<K, V>
where K: Bake, V: Bake,

source§

fn bake(&self, ctx: &CrateEnv) -> TokenStream

source§

impl<K, V> Bake for HashMap<K, V>
where K: Bake, V: Bake,

source§

fn bake(&self, ctx: &CrateEnv) -> TokenStream

source§

impl<T> Bake for &[T]
where T: Bake,

source§

fn bake(&self, ctx: &CrateEnv) -> TokenStream

source§

impl<T> Bake for Cow<'_, T>
where T: ?Sized + ToOwned, for<'a> &'a T: Bake,

source§

fn bake(&self, ctx: &CrateEnv) -> TokenStream

source§

impl<T> Bake for Option<T>
where T: Bake,

source§

fn bake(&self, ctx: &CrateEnv) -> TokenStream

source§

impl<T> Bake for &T
where T: Bake,

source§

fn bake(&self, ctx: &CrateEnv) -> TokenStream

source§

impl<T> Bake for Box<T>
where T: Bake,

source§

fn bake(&self, ctx: &CrateEnv) -> TokenStream

source§

impl<T> Bake for BTreeSet<T>
where T: Bake,

source§

fn bake(&self, ctx: &CrateEnv) -> TokenStream

source§

impl<T> Bake for Rc<T>
where T: Bake,

source§

fn bake(&self, ctx: &CrateEnv) -> TokenStream

source§

impl<T> Bake for Arc<T>
where T: Bake,

source§

fn bake(&self, ctx: &CrateEnv) -> TokenStream

source§

impl<T> Bake for Vec<T>
where T: Bake,

source§

fn bake(&self, ctx: &CrateEnv) -> TokenStream

source§

impl<T> Bake for HashSet<T>
where T: Bake,

source§

fn bake(&self, ctx: &CrateEnv) -> TokenStream

source§

impl<T, E> Bake for Result<T, E>
where T: Bake, E: Bake,

source§

fn bake(&self, ctx: &CrateEnv) -> TokenStream

source§

impl<T, const N: usize> Bake for [T; N]
where T: Bake,

source§

fn bake(&self, ctx: &CrateEnv) -> TokenStream

source§

impl<T: ?Sized> Bake for PhantomData<T>

source§

fn bake(&self, _ctx: &CrateEnv) -> TokenStream

Implementors§

source§

impl<B, T> Bake for IteratorAsRefSlice<B, T>
where for<'a> &'a B: IntoIterator<Item = &'a T>, T: Bake,

source§

impl<T> Bake for AsStaticStr<T>
where T: AsRef<str>,