fn extract_state(
        &'m self,
        context: &Context,
    ) -> Result<&'m State, MaeveError> {
        let state = match Scope::from_i32(context.scope)? {
            Scope::Character => self.person.stats.get(&context.id)?,
            Scope::Level => self.level.state.as_ref().unwrap(),
            Scope::Item => self.items.get(&context.id)?.state.as_ref().unwrap(),
            Scope::Global => self.game.globals.get(&context.id)?,
        };
        return Ok(state);
    }
/* TODO: Create a mutable version of this such that state can be
     * directly set. This would also mean not copying game in extract phase
     * such that the reference can be directly set. */
Create a mutable version of this such that state can be
directly set. This would also mean not copying game in extract phase
such that the reference can be directly set.
Create a mutable version of this such that state can be directly set . This would also mean not copying game in extract phase such that the reference can be directly set .
fn extract_state(
        &'m self,
        context: &Context,
    ) -> Result<&'m State, MaeveError> {
        let state = match Scope::from_i32(context.scope)? {
            Scope::Character => self.person.stats.get(&context.id)?,
            Scope::Level => self.level.state.as_ref().unwrap(),
            Scope::Item => self.items.get(&context.id)?.state.as_ref().unwrap(),
            Scope::Global => self.game.globals.get(&context.id)?,
        };
        return Ok(state);
    }
fn extract_state ( & ' m self , context : & Context , ) -> Result < & ' m State , MaeveError > { let state = match Scope :: from_i32 ( context . scope ) ? { Scope :: Character => self . person . stats . get ( & context . id ) ? , Scope :: Level => self . level . state . as_ref ( ) . unwrap ( ) , Scope :: Item => self . items . get ( & context . id ) ? . state . as_ref ( ) . unwrap ( ) , Scope :: Global => self . game . globals . get ( & context . id ) ? , } ; return Ok ( state ) ; }
TODO: Create a mutable version of this such that state can be
 directly set.
TODO : Create a mutable version of this such that state can be directly set .
&'m self
context
&Context