Skip to content

Releases: andrewtc/mode

v1.4.1

13 Aug 21:45
Compare
Choose a tag to compare
  • Updated logo. (Yes, the version bump was necessary—only because crates.io needed an update after changing README.md.)

v0.4.0

21 Mar 21:44
Compare
Choose a tag to compare
  • Mode no longer defines a swap() function that must be implemented in order to handle state transitions. Instead, Automaton::next() now takes in a transition_fn callback that will be called on the current Mode in order to transition the Automaton to the next state. This can call whatever functions it needs to on the current Mode in order to transition it, and can capture state from the calling function. Whatever Mode the transition_fn returns will be swapped in as active.
  • Automaton::next_with_input() has been removed.
  • Automaton::next_with_output() and Automaton::next_with_input_output() have been removed and replaced with a new Automaton::next_with_result() function. This is similar to Automaton::next(), except that the transition_fn returns a tuple with a value to be returned to the caller.
  • Family::Input and Family::Output have been removed, as they were no longer necessary.
  • boxed::Mode, sync::Mode, and rc::Mode have been removed. Instead, Mode is automatically implemented for the Box<T>, Rc<T>, and Arc<T> types where T : Mode. More impls like these may be added in the future.

v0.3.0

20 Dec 08:19
Compare
Choose a tag to compare
  • All Modes now have a Family associated type instead of a Base type.
  • Mode::get_transition() has been replaced by Mode::swap(), and Transition has been removed entirely.
  • Mode::swap() takes an input parameter and can return a value, if desired, based on the Input and Output types specified by Mode::Family.
  • Mode::as_base() and Mode::as_base_mut() have been removed.
  • Added new Mode traits in separate modules that accept pointer types such as Box, std::rc::Rc, and std::sync::Arc.
  • Automaton now stores the current Mode in-place, and is parameterized based on the Family type instead of the Base type.
  • The Family trait provides convenience functions for creating an Automaton that is compatible with the Family implementation in question.
  • Added guides for upgrading from version ^0.2 to version 0.3 of mode.

v0.2.4

03 Oct 03:47
Compare
Choose a tag to compare
  • Fixed several dyn lint errors in the examples and documentation.
  • Removed unnecessary extern crate mode line from the counter example.

v0.2.3

21 Mar 13:04
Compare
Choose a tag to compare
  • Automaton now implements Borrow and BorrowMut.
  • Added the example from README.md to the examples directory as 'activity'.
  • Improved the 'activity' example by adding debug logging.
  • Added note about GitHub issues and pull requests to the "Contributing" section of README.md.

v0.2.2

12 Feb 05:12
Compare
Choose a tag to compare
  • Automaton::perform_transitions() now returns a bool value representing whether a Transition was performed or not.
  • Added Travis CI badge to Cargo.toml.

v0.2.1

10 Feb 16:33
Compare
Choose a tag to compare
  • Base members are now directly accessible through an Automaton reference via Deref coercion. Hence, Base functions can be called directly on the parent Automaton, e.g.
    let mut automaton = Automaton::with_initial_mode(SomeMode::new());
    automaton.some_base_fn();
  • Simplified Automaton example demonstrating Modes that can hold onto &'a SomeType references.
  • Added "Releases" section to README.md with a link to GitHub.

v0.2.0

10 Feb 01:42
Compare
Choose a tag to compare
  • Added an explicit 'a lifetime to most types, representing the lifetime of the Automaton. This allows the creation of Modes 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 the Mode interface a bit.

v0.1.1

09 Feb 00:14
Compare
Choose a tag to compare
  • Standardized usage of Box<dyn Trait> across entire crate.
  • Fixed a typo in the Mode documentation referring to nonexistent get_mode() and get_mode_mut() functions on Automaton. (Should have been borrow_mode() and borrow_mode_mut().)
  • Added docs.rs documentation link to README.md and fixed a small typo.

v0.1.0

09 Feb 00:04
Compare
Choose a tag to compare
  • Initial version of Automaton, Mode, and Transition types.
  • Contains complete documentation, with examples, for all types.
  • Includes "counter" example demonstrating how to implement a simple state machine with the provided constructs.