pub struct Function { /* private fields */ }Expand description
defines a C function
Implementations§
Source§impl Function
impl Function
Sourcepub fn with_string(name: String, ret: Type) -> Self
pub fn with_string(name: String, ret: Type) -> Self
creates a new function with the given name and return type
Sourcepub fn push_doc_str(&mut self, doc: &str) -> &mut Self
pub fn push_doc_str(&mut self, doc: &str) -> &mut Self
Adds a new doc string to the function
Sourcepub fn new_param(&mut self, name: &str, ty: Type) -> &mut FunctionParam
pub fn new_param(&mut self, name: &str, ty: Type) -> &mut FunctionParam
creates a new parameter for the function
Sourcepub fn push_param(&mut self, item: FunctionParam) -> &mut Self
pub fn push_param(&mut self, item: FunctionParam) -> &mut Self
Push a param to the function’s parameters
Sourcepub fn param_by_name(&self, name: &str) -> Option<&FunctionParam>
pub fn param_by_name(&self, name: &str) -> Option<&FunctionParam>
obtains a reference to the param with the given name
Sourcepub fn param_by_name_mut(&mut self, name: &str) -> Option<&mut FunctionParam>
pub fn param_by_name_mut(&mut self, name: &str) -> Option<&mut FunctionParam>
obtains a mutable reference to the param with the given name
Sourcepub fn param_by_idx(&self, idx: usize) -> Option<&FunctionParam>
pub fn param_by_idx(&self, idx: usize) -> Option<&FunctionParam>
obtains a reference to the param with the given index (starting at 0)
Sourcepub fn param_by_idx_mut(&mut self, idx: usize) -> Option<&mut FunctionParam>
pub fn param_by_idx_mut(&mut self, idx: usize) -> Option<&mut FunctionParam>
obtains a mutable reference to the param with the given index mut
Sourcepub fn push_attribute(&mut self, attr: &str) -> &mut Self
pub fn push_attribute(&mut self, attr: &str) -> &mut Self
adds a new attribute to the function
Sourcepub fn toggle_static(&mut self, val: bool) -> &mut Self
pub fn toggle_static(&mut self, val: bool) -> &mut Self
Sourcepub fn set_static(&mut self) -> &mut Self
pub fn set_static(&mut self) -> &mut Self
sets the function to be static
Sourcepub fn toggle_inline(&mut self, val: bool) -> &mut Self
pub fn toggle_inline(&mut self, val: bool) -> &mut Self
Sourcepub fn set_inline(&mut self) -> &mut Self
pub fn set_inline(&mut self) -> &mut Self
makes the function to be an inline method
Sourcepub fn toggle_extern(&mut self, val: bool) -> &mut Self
pub fn toggle_extern(&mut self, val: bool) -> &mut Self
Sourcepub fn set_extern(&mut self) -> &mut Self
pub fn set_extern(&mut self) -> &mut Self
makes the function to be an inline method
pub fn do_fmt(&self, fmt: &mut Formatter<'_>, decl_only: bool) -> Result
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Function
impl RefUnwindSafe for Function
impl Send for Function
impl Sync for Function
impl Unpin for Function
impl UnwindSafe for Function
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