pub struct Code<'a> { /* private fields */ }Expand description
Implementations§
Source§impl Code<'_>
impl Code<'_>
Sourcepub fn call_func_with_args(&mut self, func: &str, args: Vec<CArg<'_>>)
pub fn call_func_with_args(&mut self, func: &str, args: Vec<CArg<'_>>)
Sourcepub fn new_var<S: AsRef<str>>(&mut self, name: S, value: VarInit<'_>)
pub fn new_var<S: AsRef<str>>(&mut self, name: S, value: VarInit<'_>)
§Make a new variable.
§Example
use c_emit::{Code, CArg, VarInit};
let mut code = Code::new();
code.new_var("a", VarInit::String("hello"));
assert_eq!(code.to_string(), r#"
int main() {
char a[]="hello";
return 0;
}
"#.trim_start().to_string());
§NOTE:
Set the initval argument to None to make the variable uninitialized.
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for Code<'a>
impl<'a> RefUnwindSafe for Code<'a>
impl<'a> Send for Code<'a>
impl<'a> Sync for Code<'a>
impl<'a> Unpin for Code<'a>
impl<'a> UnwindSafe for Code<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more