Releases: andrewtc/mode
Releases · andrewtc/mode
v1.4.1
v0.4.0
Mode
no longer defines aswap()
function that must be implemented in order to handle state transitions. Instead,Automaton::next()
now takes in atransition_fn
callback that will be called on the currentMode
in order to transition theAutomaton
to the next state. This can call whatever functions it needs to on the currentMode
in order to transition it, and can capture state from the calling function. WhateverMode
thetransition_fn
returns 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_fn
returns a tuple with a value to be returned to the caller.Family::Input
andFamily::Output
have been removed, as they were no longer necessary.boxed::Mode
,sync::Mode
, andrc::Mode
have been removed. Instead,Mode
is automatically implemented for theBox<T>
,Rc<T>
, andArc<T>
types whereT : Mode
. Moreimpl
s like these may be added in the future.
v0.3.0
- All
Mode
s now have aFamily
associated type instead of aBase
type. Mode::get_transition()
has been replaced byMode::swap()
, andTransition
has been removed entirely.Mode::swap()
takes aninput
parameter and can return a value, if desired, based on theInput
andOutput
types specified byMode::Family
.Mode::as_base()
andMode::as_base_mut()
have been removed.- Added new
Mode
traits in separate modules that accept pointer types such asBox
,std::rc::Rc
, andstd::sync::Arc
. Automaton
now stores the currentMode
in-place, and is parameterized based on theFamily
type instead of theBase
type.- The
Family
trait provides convenience functions for creating anAutomaton
that is compatible with theFamily
implementation in question. - Added guides for upgrading from version
^0.2
to version0.3
ofmode
.
v0.2.4
v0.2.3
v0.2.2
Automaton::perform_transitions()
now returns abool
value representing whether aTransition
was performed or not.- Added Travis CI badge to Cargo.toml.
v0.2.1
Base
members are now directly accessible through anAutomaton
reference viaDeref
coercion. Hence,Base
functions can be called directly on the parentAutomaton
, e.g.let mut automaton = Automaton::with_initial_mode(SomeMode::new()); automaton.some_base_fn();
- Simplified
Automaton
example demonstratingMode
s that can hold onto&'a SomeType
references. - Added "Releases" section to README.md with a link to GitHub.
v0.2.0
- Added an explicit
'a
lifetime to most types, representing the lifetime of theAutomaton
. This allows the creation ofMode
s 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 theMode
interface a bit.
v0.1.1
- Standardized usage of
Box<dyn Trait>
across entire crate. - Fixed a typo in the
Mode
documentation 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.