code_passenger 0.4.2

Scans a Rust workspace with klepto and does the writing: feature gates across every crate from one features document, proven by cargo check, Cargo.toml edits, file headers from the plan, and the history of it.
Documentation
use super::{produce::produce, reducer::reduce_in_place, action::Action, state::AnalysisState};

#[derive(Debug, Default, Clone)]
pub struct Store {
    st: AnalysisState,
}

impl Store {
    pub fn new() -> Self { Self { st: AnalysisState::default() } }
    pub fn state(&self) -> &AnalysisState { &self.st }
    pub fn into_state(self) -> AnalysisState { self.st }

    pub fn dispatch(&mut self, a: Action) {
        self.dispatch_many(std::iter::once(a));
    }

    pub fn dispatch_many<I: IntoIterator<Item = Action>>(&mut self, actions: I) {
        let next = produce(&self.st, |draft| {
            for a in actions {
                reduce_in_place(draft, a);
            }
        });
        self.st = next;
    }
}