Struct mica::ll::codegen::TraitBuilder
source · pub struct TraitBuilder<'b> {
pub env: &'b mut Environment,
/* private fields */
}
Fields§
§env: &'b mut Environment
Implementations§
source§impl<'b> TraitBuilder<'b>
impl<'b> TraitBuilder<'b>
pub fn new(
env: &'b mut Environment,
parent_chunk: Option<&'b Chunk>,
name: Rc<str>
) -> Result<Self, LanguageErrorKind>
sourcepub fn add_method(
&mut self,
name: Rc<str>,
parameter_count: MethodParameterCount
) -> Result<MethodIndex, LanguageErrorKind>
pub fn add_method(
&mut self,
name: Rc<str>,
parameter_count: MethodParameterCount
) -> Result<MethodIndex, LanguageErrorKind>
Adds a function into the trait and returns its method ID and function ID.
The parameter count does not include the self
parameter.
sourcepub fn build(self) -> (TraitIndex, &'b mut Environment)
pub fn build(self) -> (TraitIndex, &'b mut Environment)
Finishes building the trait, returns its trait ID, and gives back the mutable reference to the environment.