func mutate()

in MobiusCore/Source/AsyncStartStopStateMachine.swift [68:79]


    func mutate(by closure: (inout StoppedState) throws -> Void) throws {
        dispatchPrecondition(condition: .notOnQueue(queue))
        try queue.sync {
            switch snapshot() {
            case .running:
                throw Error.wrongState
            case .stopped(var state):
                try closure(&state)
                stoppedState = state
            }
        }
    }