Struct build_const::ConstValueWriter
[−]
[src]
pub struct ConstValueWriter { /* fields omitted */ }
Created from ConstWriter::finish_dependencies
. See
documentation for ConstWriter
.
Methods
impl ConstValueWriter
[src]
pub fn add_value<T: Debug>(&mut self, name: &str, ty: &str, value: T)
[src]
Add a value to the constants file.
You have to manually specify the name
, type (ty
) and value
of the constant you want to add.
The value
uses the Debug
trait to determine the formating of
the value being added. If Debug
is not accurate or will not work,
you must use add_value_raw
instead and format it yourself.
pub fn add_value_raw(&mut self, name: &str, ty: &str, raw_value: &str)
[src]
Add a pre-formatted value to the constants file.
add_value
depends on Debug
being implemented in such a way
that it accurately represents the type's creation. Sometimes that
cannot be relied on and add_value_raw
has to be used instead.
pub fn add_array<T: Debug>(&mut self, name: &str, ty: &str, values: &[T])
[src]
Add an array of len > 0 to the constants
You have to manually specify the name
, type (ty
) of the items and
values
of the array constant you want to add. The length of the array
is determined automatically.
Example: const.add_array("foo", "u16", &[1,2,3])
The value
of each item uses the Debug
trait to determine the
formatting of the value being added. If Debug
is not accurate or will
not work, you must use add_array_raw
instead and format it yourself.
pub fn add_array_raw(&mut self, name: &str, ty: &str, raw_values: &[&str])
[src]
Add an array of pre-formatted values to the constants file. The length of the array is determined automatically.
add_array
depends on Debug
being implemented for each item in such a way that it
accurately represents the item's creation. Sometimes that cannot be relied on and
add_array_raw
has to be used instead.
pub fn add_raw(&mut self, raw: &str)
[src]
Add a raw string to the constants file.
This method only changes raw
by adding a \n
at the end.
pub fn finish(&mut self)
[src]
Finish writing to the constants file and consume self.