async fn update_state_prime<F, O>(&self, f: F) -> ConductorResult<(ConductorState, O)>
    where
        F: FnOnce(ConductorState) -> ConductorResult<(ConductorState, O)>,
        O: Send,
    {
        self.check_running()?;
        let output = self
            .env
            .async_commit_in_place(move |txn| {
                let state = txn
                    .query_row("SELECT blob FROM ConductorState WHERE id = 1", [], |row| {
                        row.get("blob")
                    })
                    .optional()?;
                let state = match state {
                    Some(state) => from_blob(state)?,
                    None => ConductorState::default(),
                };
                let (new_state, output) = f(state)?;
                mutations::insert_conductor_state(txn, (&new_state).try_into()?)?;
                Result::<_, ConductorError>::Ok((new_state, output))
            })
            .await?;
        Ok(output)
    }
/// Update the internal state with a pure function mapping old state to new,
/// which may also produce an output value which will be the output of
/// this function
Update the internal state with a pure function mapping old state to new,
which may also produce an output value which will be the output of
this function
Update the internal state with a pure function mapping old state to new which may also produce an output value which will be the output of this function
async fn update_state_prime<F, O>(&self, f: F) -> ConductorResult<(ConductorState, O)>
    where
        F: FnOnce(ConductorState) -> ConductorResult<(ConductorState, O)>,
        O: Send,
    {
        self.check_running()?;
        let output = self
            .env
            .async_commit_in_place(move |txn| {
                let state = txn
                    .query_row("SELECT blob FROM ConductorState WHERE id = 1", [], |row| {
                        row.get("blob")
                    })
                    .optional()?;
                let state = match state {
                    Some(state) => from_blob(state)?,
                    None => ConductorState::default(),
                };
                let (new_state, output) = f(state)?;
                mutations::insert_conductor_state(txn, (&new_state).try_into()?)?;
                Result::<_, ConductorError>::Ok((new_state, output))
            })
            .await?;
        Ok(output)
    }
async fn update_state_prime < F , O > ( & self , f : F ) -> ConductorResult < ( ConductorState , O ) > where F : FnOnce ( ConductorState ) -> ConductorResult < ( ConductorState , O ) > , O : Send , { self . check_running ( ) ? ; let output = self . env . async_commit_in_place ( move | txn | { let state = txn . query_row ( " " , [ ] , | row | { row . get ( " " ) } ) . optional ( ) ? ; let state = match state { Some ( state ) => from_blob ( state ) ? , None => ConductorState :: default ( ) , } ; let ( new_state , output ) = f ( state ) ? ; mutations :: insert_conductor_state ( txn , ( & new_state ) . try_into ( ) ? ) ? ; Result :: < _ , ConductorError > :: Ok ( ( new_state , output ) ) } ) . await ? ; Ok ( output ) }
Update the internal state with a pure function mapping old state to new,
which may also produce an output value which will be the output of
this function
Update the internal state with a pure function mapping old state to new which may also produce an output value which will be the output of this function
&self
f
F
&self
f
F