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_string<S: AsRef<str>>(
&mut self,
name: S,
initval: Option<S>,
size: Option<u32>
)
pub fn new_var_string<S: AsRef<str>>( &mut self, name: S, initval: Option<S>, size: Option<u32> )
§Make a new string variable.
§Example
use c_emit::{Code, CArg};
let mut code = Code::new();
code.new_var_string("a", Some("hello"), None);
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