From 5e1e12afe16fe9a0a0dd1fdae0621f6f9feb98fd Mon Sep 17 00:00:00 2001 From: Andrew Thomas Christensen Date: Wed, 2 Oct 2019 20:17:37 -0700 Subject: [PATCH] Squashed commit of the following: commit 949b56f2b3bd19a443ffc7ddbf8e9045e42a1458 Author: Andrew Thomas Christensen Date: Wed Oct 2 20:15:50 2019 -0700 Bump version to v0.2.4 commit ffb5427f17666e92c5d9a8afc89a99c4ff1ba887 Author: Andrew Thomas Christensen Date: Sun Sep 22 15:56:46 2019 -0700 Fix `dyn` warnings in examples Merge v0.2.4 into master --- Cargo.toml | 2 +- README.md | 6 +++--- examples/activity.rs | 6 +++--- examples/counter.rs | 2 -- src/lib.rs | 6 +++--- src/mode.rs | 4 ++-- 6 files changed, 12 insertions(+), 14 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 0ce7f4c..9219d99 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "mode" -version = "0.2.3" +version = "0.2.4" authors = ["Andrew Thomas Christensen "] edition = "2018" diff --git a/README.md b/README.md index 9615a13..eff7cc3 100644 --- a/README.md +++ b/README.md @@ -40,7 +40,7 @@ impl Activity for Working { } impl<'a> Mode<'a> for Working { - type Base = Activity + 'a; + type Base = dyn Activity + 'a; fn as_base(&self) -> &Self::Base { self } fn as_base_mut(&mut self) -> &mut Self::Base { self } @@ -71,7 +71,7 @@ impl Activity for Eating { } impl<'a> Mode<'a> for Eating { - type Base = Activity + 'a; + type Base = dyn Activity + 'a; fn as_base(&self) -> &Self::Base { self } fn as_base_mut(&mut self) -> &mut Self::Base { self } fn get_transition(&mut self) -> Option> { @@ -103,7 +103,7 @@ impl Activity for Sleeping { } impl<'a> Mode<'a> for Sleeping { - type Base = Activity + 'a; + type Base = dyn Activity + 'a; fn as_base(&self) -> &Self::Base { self } fn as_base_mut(&mut self) -> &mut Self::Base { self } fn get_transition(&mut self) -> Option> { diff --git a/examples/activity.rs b/examples/activity.rs index 09b44b1..3f240da 100644 --- a/examples/activity.rs +++ b/examples/activity.rs @@ -25,7 +25,7 @@ impl Activity for Working { } impl<'a> Mode<'a> for Working { - type Base = Activity + 'a; + type Base = dyn Activity + 'a; fn as_base(&self) -> &Self::Base { self } fn as_base_mut(&mut self) -> &mut Self::Base { self } @@ -56,7 +56,7 @@ impl Activity for Eating { } impl<'a> Mode<'a> for Eating { - type Base = Activity + 'a; + type Base = dyn Activity + 'a; fn as_base(&self) -> &Self::Base { self } fn as_base_mut(&mut self) -> &mut Self::Base { self } fn get_transition(&mut self) -> Option> { @@ -88,7 +88,7 @@ impl Activity for Sleeping { } impl<'a> Mode<'a> for Sleeping { - type Base = Activity + 'a; + type Base = dyn Activity + 'a; fn as_base(&self) -> &Self::Base { self } fn as_base_mut(&mut self) -> &mut Self::Base { self } fn get_transition(&mut self) -> Option> { diff --git a/examples/counter.rs b/examples/counter.rs index 16caab0..4baf12a 100644 --- a/examples/counter.rs +++ b/examples/counter.rs @@ -4,8 +4,6 @@ // MIT license , at your option. This file may not be copied, // modified, or distributed except according to those terms. -extern crate mode; - use mode::*; use std::fmt::Debug; diff --git a/src/lib.rs b/src/lib.rs index a01deb8..1979da8 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -37,7 +37,7 @@ //! } //! //! impl<'a> Mode<'a> for Working { -//! type Base = Activity + 'a; +//! type Base = dyn Activity + 'a; //! fn as_base(&self) -> &Self::Base { self } //! fn as_base_mut(&mut self) -> &mut Self::Base { self } //! @@ -68,7 +68,7 @@ //! } //! //! impl<'a> Mode<'a> for Eating { -//! type Base = Activity + 'a; +//! type Base = dyn Activity + 'a; //! fn as_base(&self) -> &Self::Base { self } //! fn as_base_mut(&mut self) -> &mut Self::Base { self } //! fn get_transition(&mut self) -> Option> { @@ -100,7 +100,7 @@ //! } //! //! impl<'a> Mode<'a> for Sleeping { -//! type Base = Activity + 'a; +//! type Base = dyn Activity + 'a; //! fn as_base(&self) -> &Self::Base { self } //! fn as_base_mut(&mut self) -> &mut Self::Base { self } //! fn get_transition(&mut self) -> Option> { diff --git a/src/mode.rs b/src/mode.rs index 27f6b4c..4006864 100644 --- a/src/mode.rs +++ b/src/mode.rs @@ -35,7 +35,7 @@ use crate::TransitionBox; /// impl MyMode for ModeA { } /// /// impl<'a> Mode<'a> for ModeA { -/// type Base = MyMode + 'a; +/// type Base = dyn MyMode + 'a; /// fn as_base(&self) -> &Self::Base { self } /// fn as_base_mut(&mut self) -> &mut Self::Base { self } /// fn get_transition(&mut self) -> Option> { @@ -48,7 +48,7 @@ use crate::TransitionBox; /// impl MyMode for ModeB { } /// /// impl<'a> Mode<'a> for ModeB { -/// type Base = MyMode + 'a; +/// type Base = dyn MyMode + 'a; /// fn as_base(&self) -> &Self::Base { self } /// fn as_base_mut(&mut self) -> &mut Self::Base { self } /// fn get_transition(&mut self) -> Option> { None } // None means don't transition.