pub struct Block { /* private fields */ }
Expand description
Defines a code block. This is used to define a function body.
Implementations§
Source§impl Block
impl Block
Sourcepub fn push_block(&mut self, block: Block) -> &mut Self
pub fn push_block(&mut self, block: Block) -> &mut Self
Push a nested block to this block.
§Arguments
block
- The block to push to this block.
§Examples
use rust_codegen::Block;
let mut block_1 = Block::new("");
block_1.line("println!(\"Hello, world!\");");
let mut block_2 = Block::new("");
block_2.line("println!(\"from Rust!!\");");
block_1.push_block(block_2);
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Block
impl RefUnwindSafe for Block
impl Send for Block
impl Sync for Block
impl Unpin for Block
impl UnwindSafe for Block
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