[−][src]Struct darklua_core::LuaGenerator
A struct to control how the Lua code is generated. Content can be pushed into the generator and it will automatically add spaces when necessary.
Methods
impl LuaGenerator
[src]
pub fn new(column_span: usize) -> Self
[src]
Creates a generator that will wrap the code on a new line after the amount of
characters given by the column_span
argument.
pub fn push_str(&mut self, content: &str)
[src]
Appends a string to the current content of the LuaGenerator. A space may be added depending of the last character of the current content and the first character pushed.
pub fn push_char(&mut self, character: char)
[src]
Same as the push_str
function, but for a single character.
pub fn push_char_force_without_space(&mut self, character: char)
[src]
This function pushes a character into the string, without appending a new line character if the line is about to exceed the column span amount.
pub fn into_string(self) -> String
[src]
Consumes the LuaGenerator and produce a String object.
pub fn for_each_and_between<T, F, G>(
&mut self,
vector: &Vec<T>,
for_each: F,
between: G
) where
F: FnMut(&mut Self, &T),
G: FnMut(&mut Self),
[src]
&mut self,
vector: &Vec<T>,
for_each: F,
between: G
) where
F: FnMut(&mut Self, &T),
G: FnMut(&mut Self),
A utility function to iterate on a vector and call the for_each
function with each
element of the vector and the between
function between each element. It is useful
when generating lists separated with a comma.
Trait Implementations
impl Default for LuaGenerator
[src]
Auto Trait Implementations
impl RefUnwindSafe for LuaGenerator
impl Send for LuaGenerator
impl Sync for LuaGenerator
impl Unpin for LuaGenerator
impl UnwindSafe for LuaGenerator
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,