Skip to main content

FunctionBuilder

Struct FunctionBuilder 

Source
pub struct FunctionBuilder<'a> { /* private fields */ }

Implementations§

Source§

impl<'a> FunctionBuilder<'a>

Source

pub fn new( contract_name: String, name: String, context: &'a mut IRContext, registry: &'a mut IRRegistry, ) -> Self

Source

pub fn param(&mut self, name: &str, ty: Type) -> &mut Self

Source

pub fn get_params(&self) -> &Vec<Parameter>

Source

pub fn returns(&mut self, ty: Type) -> &mut Self

Source

pub fn returns_multiple(&mut self, types: Vec<Type>) -> &mut Self

Source

pub fn visibility(&mut self, vis: Visibility) -> &mut Self

Source

pub fn mutability(&mut self, mut_: Mutability) -> &mut Self

Source

pub fn modifier(&mut self, _name: &str) -> &mut Self

Source

pub fn create_block_id(&mut self) -> BlockId

Source

pub fn switch_to_block(&mut self, block_id: BlockId) -> Result<BlockBuilder<'_>>

Source

pub fn current_block(&self) -> Option<BlockId>

Source

pub fn entry_block(&mut self) -> BlockBuilder<'_>

Source

pub fn new_block(&mut self, _name: &str) -> BlockBuilder<'_>

Source

pub fn block(&mut self, _name: &str) -> BlockBuilder<'_>

Source

pub fn block_with_id(&mut self, block_id: BlockId) -> BlockBuilder<'_>

Source

pub fn local(&mut self, name: &str, ty: Type) -> Value

Source

pub fn get_param(&self, index: usize) -> Value

Source

pub fn current_function(&self) -> &Function

Source

pub fn build(self) -> Result<Function>

Auto Trait Implementations§

§

impl<'a> !UnwindSafe for FunctionBuilder<'a>

§

impl<'a> Freeze for FunctionBuilder<'a>

§

impl<'a> RefUnwindSafe for FunctionBuilder<'a>

§

impl<'a> Send for FunctionBuilder<'a>

§

impl<'a> Sync for FunctionBuilder<'a>

§

impl<'a> Unpin for FunctionBuilder<'a>

§

impl<'a> UnsafeUnpin for FunctionBuilder<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.