From e32142df81e5c3836cdd350a2c4e0252a18c3d7f Mon Sep 17 00:00:00 2001 From: Adrien Burgun Date: Sun, 26 Jun 2022 18:49:05 +0200 Subject: [PATCH] :pencil: Remove doc warnings --- stackline/src/signal.rs | 8 +++++++- stackline/src/tile/mod.rs | 10 ++++++++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/stackline/src/signal.rs b/stackline/src/signal.rs index 4fd49f4..de1652b 100644 --- a/stackline/src/signal.rs +++ b/stackline/src/signal.rs @@ -177,7 +177,13 @@ impl Signal { self.stack.len() } - // TODO: stack(), stack_mut() and other stack manipulation tools + pub fn stack(&self) -> &Vec { + &self.stack + } + + pub fn stack_mut(&mut self) -> &mut Vec { + &mut self.stack + } } /// Creates a signal with initial values in its stack. diff --git a/stackline/src/tile/mod.rs b/stackline/src/tile/mod.rs index 8be06fb..d1d4089 100644 --- a/stackline/src/tile/mod.rs +++ b/stackline/src/tile/mod.rs @@ -39,11 +39,16 @@ include!(concat!(env!("OUT_DIR"), "/anytile.rs")); /// Let's start by implementing a basic [`Tile`], which simply forwards any incomming [`Signal`] to its right. /// Create a file in the `tiles/` folder containing the following /// -/// ```ignore +/// ```no_run /// // First, import the needed types. Because we are writing files /// // that will be part of the "stackline" crate, we have to import them using `crate`: +/// # /* /// use crate::prelude::*; /// use crate::tile::prelude::*; +/// # */ +/// # // Doctests don't allow us to use `crate` to refer to the current crate +/// # use stackline::prelude::*; +/// # use stackline::tile::prelude::*; /// /// // Tiles must implement Clone and Debug /// #[derive(Clone, Debug)] @@ -68,7 +73,8 @@ include!(concat!(env!("OUT_DIR"), "/anytile.rs")); /// /// // First, get the coordinates of the tile to our right: /// if let Some(right_position) = context.offset((1, 0)) { -/// // Then, send the signal! We need to tell that we are moving the signal to the right. +/// // Then, send the signal! +/// // We also need to tell the signal that it is moving to the right. /// context.send(right_position, signal.moved(Direction::Right)); /// } /// }