Trait const_gen::CompileConst[][src]

pub trait CompileConst {
    fn const_type() -> String;
fn const_val(&self) -> String; fn const_declaration(&self, name: &str) -> String { ... }
fn const_definition(_attrs: &str) -> String { ... } }

Trait which defines how a type should be represented as a constant

Required methods

fn const_type() -> String[src]

Get a string representation of a type. This must be implemented for each type. Note that this is not necessarily a representation of the ACTUAL type, but rather the type that should be used if this data is going to be represented as a compile-time constant.

fn const_val(&self) -> String[src]

Get a string representation of the current value in constant form.

Loading content...

Provided methods

fn const_declaration(&self, name: &str) -> String[src]

Takes a string (a SCREAMING_SNAKE_CASE string is preferred) to use as a constant name, then calls self.const_type() and self.const_val() in order to generate a Rust compile-time constant declaration statement.

fn const_definition(_attrs: &str) -> String[src]

Return a const definition for this type. Attributes may be included, and must be formatted as the compiler would expect to see them (including the pound sign and square brackets "#[...]"). Always returns an empty string for types defined in the standard library. Typically this is easier to call instead through the const_definition! macro.

Loading content...

Implementations on Foreign Types

impl CompileConst for u8[src]

impl CompileConst for u16[src]

impl CompileConst for u32[src]

impl CompileConst for u64[src]

impl CompileConst for u128[src]

impl CompileConst for usize[src]

impl CompileConst for i8[src]

impl CompileConst for i16[src]

impl CompileConst for i32[src]

impl CompileConst for i64[src]

impl CompileConst for i128[src]

impl CompileConst for isize[src]

impl CompileConst for f32[src]

impl CompileConst for f64[src]

impl CompileConst for String[src]

impl CompileConst for &str[src]

impl CompileConst for str[src]

impl<T: CompileConst> CompileConst for Vec<T>[src]

impl<T: CompileConst> CompileConst for &[T][src]

impl<T: CompileConst> CompileConst for Box<T>[src]

impl<T: CompileConst + Clone> CompileConst for Cow<'_, T>[src]

impl<T: CompileConst> CompileConst for Rc<T>[src]

impl<T: CompileConst> CompileConst for Arc<T>[src]

impl<K: CompileConst, V: CompileConst> CompileConst for HashMap<K, V>[src]

impl<E: CompileConst> CompileConst for HashSet<E>[src]

impl CompileConst for ()[src]

impl<A: CompileConst, B: CompileConst> CompileConst for (A, B)[src]

impl<A: CompileConst, B: CompileConst, C: CompileConst> CompileConst for (A, B, C)[src]

impl<A: CompileConst, B: CompileConst, C: CompileConst, D: CompileConst> CompileConst for (A, B, C, D)[src]

impl<A: CompileConst, B: CompileConst, C: CompileConst, D: CompileConst, E: CompileConst> CompileConst for (A, B, C, D, E)[src]

impl<A: CompileConst, B: CompileConst, C: CompileConst, D: CompileConst, E: CompileConst, F: CompileConst> CompileConst for (A, B, C, D, E, F)[src]

impl<A: CompileConst, B: CompileConst, C: CompileConst, D: CompileConst, E: CompileConst, F: CompileConst, G: CompileConst> CompileConst for (A, B, C, D, E, F, G)[src]

impl<A: CompileConst, B: CompileConst, C: CompileConst, D: CompileConst, E: CompileConst, F: CompileConst, G: CompileConst, H: CompileConst> CompileConst for (A, B, C, D, E, F, G, H)[src]

impl<A: CompileConst, B: CompileConst, C: CompileConst, D: CompileConst, E: CompileConst, F: CompileConst, G: CompileConst, H: CompileConst, I: CompileConst> CompileConst for (A, B, C, D, E, F, G, H, I)[src]

impl<A: CompileConst, B: CompileConst, C: CompileConst, D: CompileConst, E: CompileConst, F: CompileConst, G: CompileConst, H: CompileConst, I: CompileConst, J: CompileConst> CompileConst for (A, B, C, D, E, F, G, H, I, J)[src]

impl<A: CompileConst, B: CompileConst, C: CompileConst, D: CompileConst, E: CompileConst, F: CompileConst, G: CompileConst, H: CompileConst, I: CompileConst, J: CompileConst, K: CompileConst> CompileConst for (A, B, C, D, E, F, G, H, I, J, K)[src]

impl<A: CompileConst, B: CompileConst, C: CompileConst, D: CompileConst, E: CompileConst, F: CompileConst, G: CompileConst, H: CompileConst, I: CompileConst, J: CompileConst, K: CompileConst, L: CompileConst> CompileConst for (A, B, C, D, E, F, G, H, I, J, K, L)[src]

impl<A: CompileConst, B: CompileConst, C: CompileConst, D: CompileConst, E: CompileConst, F: CompileConst, G: CompileConst, H: CompileConst, I: CompileConst, J: CompileConst, K: CompileConst, L: CompileConst, M: CompileConst> CompileConst for (A, B, C, D, E, F, G, H, I, J, K, L, M)[src]

impl<A: CompileConst, B: CompileConst, C: CompileConst, D: CompileConst, E: CompileConst, F: CompileConst, G: CompileConst, H: CompileConst, I: CompileConst, J: CompileConst, K: CompileConst, L: CompileConst, M: CompileConst, N: CompileConst> CompileConst for (A, B, C, D, E, F, G, H, I, J, K, L, M, N)[src]

impl<A: CompileConst, B: CompileConst, C: CompileConst, D: CompileConst, E: CompileConst, F: CompileConst, G: CompileConst, H: CompileConst, I: CompileConst, J: CompileConst, K: CompileConst, L: CompileConst, M: CompileConst, N: CompileConst, O: CompileConst> CompileConst for (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O)[src]

impl<A: CompileConst, B: CompileConst, C: CompileConst, D: CompileConst, E: CompileConst, F: CompileConst, G: CompileConst, H: CompileConst, I: CompileConst, J: CompileConst, K: CompileConst, L: CompileConst, M: CompileConst, N: CompileConst, O: CompileConst, P: CompileConst> CompileConst for (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P)[src]

Loading content...

Implementors

Loading content...