From 10dd799678120404384bed807e346d12c734b228 Mon Sep 17 00:00:00 2001 From: Ben Frankel Date: Fri, 16 Aug 2024 18:20:24 -0700 Subject: [PATCH] Ignore non-doctest code blocks --- src/access.rs | 8 ++++---- src/extra/bevy_state.rs | 8 ++++---- src/extra/split.rs | 4 ++-- src/lib.rs | 18 +++++++++--------- src/next_state.rs | 2 +- src/pattern.rs | 12 ++++++------ src/state.rs | 2 +- 7 files changed, 27 insertions(+), 27 deletions(-) diff --git a/src/access.rs b/src/access.rs index 89d68e6..ec5d40a 100644 --- a/src/access.rs +++ b/src/access.rs @@ -102,7 +102,7 @@ impl CurrentMut<'_, S> { /// /// # Example /// -/// ```rust +/// ```ignore /// fn spawn_new_menu(menu: NextStateRef) { /// match menu.unwrap() { /// Menu::Main => spawn_main_menu(), @@ -157,7 +157,7 @@ impl NextRef<'_, '_, S> { /// /// # Example /// -/// ```rust +/// ```ignore /// fn toggle_blue(mut color: NextMut) { /// let mut color = color.unwrap_mut(); /// color.blue = !color.blue; @@ -288,7 +288,7 @@ impl NextMut<'_, '_, S> { /// /// # Example /// -/// ```rust +/// ```ignore /// fn same_red(color: FlushRef) -> bool { /// color.will_trans(&ColorState::when(|x, y| x.red == y.red)) /// } @@ -362,7 +362,7 @@ impl FlushRef<'_, '_, S> { /// /// # Example /// -/// ```rust +/// ```ignore /// fn copy_red_to_green(mut color: FlushMut) { /// let (current, next) = color.unwrap_mut(); /// next.green = current.red; diff --git a/src/extra/bevy_state.rs b/src/extra/bevy_state.rs index 6003453..f663a2b 100644 --- a/src/extra/bevy_state.rs +++ b/src/extra/bevy_state.rs @@ -6,7 +6,7 @@ //! //! Opt in to [`BevyStatePlugin`] for `GameState`: //! -//! ```rust +//! ```ignore //! #[derive(State, Clone, PartialEq, Eq, Hash, Debug, Default)] //! #[state(bevy_state)] //! enum GameState { @@ -19,13 +19,13 @@ //! //! Add `GameState` along with its [`BevyState`] wrapper: //! -//! ```rust +//! ```ignore //! app.init_state::(); //! ``` //! //! Change `GameState` to drive `BevyState`: //! -//! ```rust +//! ```ignore //! app.add_systems(Update, GameState::Title.on_update( //! GameState::Loading.enter().run_if(input_just_pressed(KeyCode::Enter)), //! )); @@ -34,7 +34,7 @@ //! Change `BevyState` to drive `GameState` (e.g. using //! [iyes_progress](https://github.com/IyesGames/iyes_progress)): //! -//! ```rust +//! ```ignore //! app.add_plugins( //! ProgressPlugin::new(GameState::Loading.bevy()) //! .continue_to(GameState::Playing.bevy()), diff --git a/src/extra/split.rs b/src/extra/split.rs index eebbfd7..4b7b6cc 100644 --- a/src/extra/split.rs +++ b/src/extra/split.rs @@ -15,7 +15,7 @@ /// /// Define your own split state type as a newtype: /// -/// ```rust +/// ```ignore /// #[derive(State, Clone, PartialEq, Eq)] /// pub struct MyState(pub SplitState); /// ``` @@ -25,7 +25,7 @@ pub type SplitState = &'static str; /// /// # Example /// -/// ```rust +/// ```ignore /// add_to_split_state!(MyState, Foo, Bar); /// add_to_split_state!(MyState, Quux); /// ``` diff --git a/src/lib.rs b/src/lib.rs index 773820d..ca1e7f8 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -20,27 +20,27 @@ //! //! Import the [prelude] to bring traits and common types into scope: //! -//! ```rust +//! ``` //! use pyri_state::prelude::*; //! ``` //! //! Define your own [`State`](state::State) type using the //! [derive macro](pyri_state_derive::State): //! -//! ```rust +//! ```ignore //! #[derive(State, Clone, PartialEq, Eq, Default)] //! struct Level(pub usize); //! ``` //! //! Add [`StatePlugin`](setup::StatePlugin) and initialize your state type: //! -//! ```rust +//! ```ignore //! app.add_plugins(StatePlugin).init_state::(); //! ``` //! //! Add update systems with [`StatePattern::on_update`](pattern::StatePattern::on_update): //! -//! ```rust +//! ```ignore //! app.add_systems(Update, ( //! Level::ANY.on_update(update_level_timer), //! Level(10).on_update(update_boss_health_bar), @@ -50,7 +50,7 @@ //! //! Add flush hooks with other [`StatePattern`](pattern::StatePattern) methods: //! -//! ```rust +//! ```ignore //! app.add_systems(StateFlush, ( //! // Short-hand for `on_exit` followed by `on_enter`. //! Level::ANY.on_edge(despawn_old_level, spawn_new_level), @@ -77,7 +77,7 @@ pub mod state; /// /// Import the prelude to get started: /// -/// ```rust +/// ``` /// use pyri_state::prelude::*; /// ``` pub mod prelude { @@ -131,14 +131,14 @@ pub mod prelude { /// /// The derive macro requires `Clone`, `PartialEq`, and `Eq`: /// - /// ```rust + /// ```ignore /// #[derive(State, Clone, PartialEq, Eq)] /// enum GameState { ... } /// ``` /// /// They can be omitted if you disable the default options: /// - /// ```rust + /// ```ignore /// #[derive(State)] /// #[state(no_defaults)] /// struct RawState; @@ -146,7 +146,7 @@ pub mod prelude { /// /// The following options are provided: /// - /// ```rust + /// ```ignore /// #[derive(State, Clone, PartialEq, Eq, Hash, Debug)] /// #[state( /// // Disable default plugins: detect_change, flush_event, apply_flush. diff --git a/src/next_state.rs b/src/next_state.rs index 27d1ecd..107c196 100644 --- a/src/next_state.rs +++ b/src/next_state.rs @@ -55,7 +55,7 @@ impl Default for TriggerStateFlush { /// The default `NextState` type is [`NextStateBuffer`](buffer::NextStateBuffer). /// You can set a different `NextState` type in the [derive macro](pyri_state_derive::State): /// -/// ```rust +/// ```ignore /// #[derive(State, Clone, PartialEq, Eq)] /// #[state(next(NextStateStack))] /// enum MenuState { ... } diff --git a/src/pattern.rs b/src/pattern.rs index 2550b16..a79409d 100644 --- a/src/pattern.rs +++ b/src/pattern.rs @@ -135,7 +135,7 @@ impl StatePattern for S { /// /// The usual way to use `AnyStatePattern` is through the associated constant [`State::ANY`]: /// -/// ```rust +/// ```ignore /// Level::ANY.on_enter(reset_timer) /// ``` pub struct AnyStatePattern(pub(crate) PhantomData); @@ -159,7 +159,7 @@ impl StatePattern for AnyStatePattern { /// The usual way to construct this type is with the [`state!`](crate::state!) macro or /// [`State::with`]: /// -/// ```rust +/// ```ignore /// state!(Level(4 | 7 | 10)).on_enter(save_checkpoint) /// Level::with(|x| x.0 < 4).on_refresh(my_systems) /// ``` @@ -257,7 +257,7 @@ impl, P2: StatePattern> StateTransPattern fo /// /// The usual way to use this type is through the associated constant [`State::ANY_TO_ANY`]: /// -/// ```rust +/// ```ignore /// Level::ANY_TO_ANY.on_trans(reset_timer) /// /// // Equivalent to: @@ -279,7 +279,7 @@ impl StateTransPattern for AnyStateTransPattern { /// The usual way to construct this type is with the [`state!`](crate::state!) macro or /// [`State::when`]: /// -/// ```rust +/// ```ignore /// state!(Level(2..=5 | 7) => Level(8 | 10)).on_enter(spawn_something_cool) /// Level::when(|x, y| y.0 > x.0).on_enter(play_next_level_sfx) /// ``` @@ -313,13 +313,13 @@ where /// /// State pattern-matching: /// -/// ```rust +/// ```ignore /// state!(Level(4 | 7 | 10)).on_enter(save_checkpoint) /// ``` /// /// State transition pattern-matching: /// -/// ```rust +/// ```ignore /// state!(Level(x @ 1..=3) => y if y.0 == 10 - x).on_trans(do_something_cool) /// ``` #[macro_export] diff --git a/src/state.rs b/src/state.rs index 1f660aa..d634a14 100644 --- a/src/state.rs +++ b/src/state.rs @@ -17,7 +17,7 @@ use crate::{ /// /// This trait can be [derived](pyri_state_derive::State) or implemented manually: /// -/// ```rust +/// ```ignore /// #[derive(State, Clone, PartialEq, Eq)] /// enum GameState { ... } ///