Struct rust_codegen::Function
source · [−]Expand description
Defines a function.
Fields
body: Option<Vec<Body>>
Body contents.
Implementations
sourceimpl Function
impl Function
sourcepub fn arg_self(&mut self) -> &mut Self
pub fn arg_self(&mut self) -> &mut Self
Add self
as a function argument.
Examples
use rust_codegen::Function;
let mut foo_fn = Function::new("foo_fn");
foo_fn.arg_self();
sourcepub fn arg_ref_self(&mut self) -> &mut Self
pub fn arg_ref_self(&mut self) -> &mut Self
Add &self
as a function argument.
Examples
use rust_codegen::Function;
let mut foo_fn = Function::new("foo_fn");
foo_fn.arg_ref_self();
sourcepub fn arg_mut_self(&mut self) -> &mut Self
pub fn arg_mut_self(&mut self) -> &mut Self
Add &mut self
as a function argument.
Examples
use rust_codegen::Function;
let mut foo_fn = Function::new("foo_fn");
foo_fn.arg_mut_self();
sourcepub fn extern_abi(&mut self, abi: &str) -> &mut Self
pub fn extern_abi(&mut self, abi: &str) -> &mut Self
sourcepub fn push_block(&mut self, block: Block) -> &mut Self
pub fn push_block(&mut self, block: Block) -> &mut Self
sourcepub fn fmt(&self, is_trait: bool, fmt: &mut Formatter<'_>) -> Result
pub fn fmt(&self, is_trait: bool, fmt: &mut Formatter<'_>) -> Result
Formats the function using the given formatter.
Arguments
is_trait
- Indicates whether it is a trait or not.fmt
- The formatter to use.
Examples
use rust_codegen::*;
let mut dest = String::new();
let mut fmt = Formatter::new(&mut dest);
let mut foo_fn = Function::new("foo_fn");
foo_fn.fmt(false, &mut fmt);
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Function
impl Send for Function
impl Sync for Function
impl Unpin for Function
impl UnwindSafe for Function
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