Struct rust_codegen::Block
source · [−]pub struct Block { /* private fields */ }
Expand description
Defines a code block. This is used to define a function body.
Implementations
sourceimpl 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 RefUnwindSafe for Block
impl Send for Block
impl Sync for Block
impl Unpin for Block
impl UnwindSafe for Block
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more