Struct code_generator::CodeBody
source · pub struct CodeBody { /* private fields */ }
Implementations§
source§impl CodeBody
impl CodeBody
sourcepub fn new(code: Vec<Box<dyn CodeGenerate>>) -> CodeBody
pub fn new(code: Vec<Box<dyn CodeGenerate>>) -> CodeBody
Creates a CodeBody generator
This struct is used for code bodies. Think the body to an if statement, function, or struct. This handles the brace/newline format of that body
let code_body = CodeBody::new(vec![
Box::new(String::from("Body"))
]);
let info = CodeGenerationInfo::from_style(CodeStyle::KnR);
assert_eq!("{\r\n Body\r\n}", format!("{}", code_body.display(info)));
let info = CodeGenerationInfo::from_style(CodeStyle::Horstmann);
assert_eq!("{ Body\r\n}", format!("{}", code_body.display(info)));
Trait Implementations§
Auto Trait Implementations§
impl Freeze for CodeBody
impl !RefUnwindSafe for CodeBody
impl !Send for CodeBody
impl !Sync for CodeBody
impl Unpin for CodeBody
impl !UnwindSafe for CodeBody
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