Releases: andrewtc/mode
Releases · andrewtc/mode
v1.4.1
v0.4.0
Modeno longer defines aswap()function that must be implemented in order to handle state transitions. Instead,Automaton::next()now takes in atransition_fncallback that will be called on the currentModein order to transition theAutomatonto the next state. This can call whatever functions it needs to on the currentModein order to transition it, and can capture state from the calling function. WhateverModethetransition_fnreturns will be swapped in as active.Automaton::next_with_input()has been removed.Automaton::next_with_output()andAutomaton::next_with_input_output()have been removed and replaced with a newAutomaton::next_with_result()function. This is similar toAutomaton::next(), except that thetransition_fnreturns a tuple with a value to be returned to the caller.Family::InputandFamily::Outputhave been removed, as they were no longer necessary.boxed::Mode,sync::Mode, andrc::Modehave been removed. Instead,Modeis automatically implemented for theBox<T>,Rc<T>, andArc<T>types whereT : Mode. Moreimpls like these may be added in the future.
v0.3.0
- All
Modes now have aFamilyassociated type instead of aBasetype. Mode::get_transition()has been replaced byMode::swap(), andTransitionhas been removed entirely.Mode::swap()takes aninputparameter and can return a value, if desired, based on theInputandOutputtypes specified byMode::Family.Mode::as_base()andMode::as_base_mut()have been removed.- Added new
Modetraits in separate modules that accept pointer types such asBox,std::rc::Rc, andstd::sync::Arc. Automatonnow stores the currentModein-place, and is parameterized based on theFamilytype instead of theBasetype.- The
Familytrait provides convenience functions for creating anAutomatonthat is compatible with theFamilyimplementation in question. - Added guides for upgrading from version
^0.2to version0.3ofmode.
v0.2.4
v0.2.3
v0.2.2
Automaton::perform_transitions()now returns aboolvalue representing whether aTransitionwas performed or not.- Added Travis CI badge to Cargo.toml.
v0.2.1
Basemembers are now directly accessible through anAutomatonreference viaDerefcoercion. Hence,Basefunctions can be called directly on the parentAutomaton, e.g.let mut automaton = Automaton::with_initial_mode(SomeMode::new()); automaton.some_base_fn();
- Simplified
Automatonexample demonstratingModes that can hold onto&'a SomeTypereferences. - Added "Releases" section to README.md with a link to GitHub.
v0.2.0
- Added an explicit
'alifetime to most types, representing the lifetime of theAutomaton. This allows the creation ofModes that hold onto references, e.g.struct SomeMode<'a> { reference : &'a mut SomeType, } impl<'a> Mode<'a> for SomeMode<'a> { // ... }
- Added a new
TransitionBox<'a, T>type alias to clean up theModeinterface a bit.
v0.1.1
- Standardized usage of
Box<dyn Trait>across entire crate. - Fixed a typo in the
Modedocumentation referring to nonexistentget_mode()andget_mode_mut()functions onAutomaton. (Should have beenborrow_mode()andborrow_mode_mut().) - Added docs.rs documentation link to README.md and fixed a small typo.