From 44c04431a89e406956131e063296212059831932 Mon Sep 17 00:00:00 2001 From: timofey Date: Sun, 30 Jul 2023 13:53:36 +0000 Subject: [PATCH] `Mode::bind`/`Mode::map` docs --- src/rcore/modes.rs | 10 ++++++++++ src/rstd/cast.rs | 2 +- src/rstd/typeless.rs | 2 +- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/rcore/modes.rs b/src/rcore/modes.rs index a1cb1de..13b2a8f 100644 --- a/src/rcore/modes.rs +++ b/src/rcore/modes.rs @@ -34,11 +34,21 @@ pub trait Mode { /// See [`FactoryParse::extend`]. type ExtensionSource; + /// Do something with the successfully parsed value, potentially failing. + /// + /// Useful for chaining parsing after [`InliningFactory`]. + /// + /// See also [`Mode::map`] + /// + /// [`InliningFactory`]: crate::rstd::inlining::InliningFactory fn bind( s: Self::ParseSuccess, f: impl FnOnce(A0) -> Result, ) -> ModeResult; + /// Map the successfully parsed value. + /// + /// See also [`Mode::bind`] fn map( s: Self::ParseSuccess, f: impl FnOnce(A0) -> A1, diff --git a/src/rstd/cast.rs b/src/rstd/cast.rs index f044570..3c08f50 100644 --- a/src/rstd/cast.rs +++ b/src/rstd/cast.rs @@ -2,7 +2,7 @@ //! See [`TypelessMentionable::cast`]/[`Point::cast`]. //! //! p.s. the implementation is horrific. -//! +//! //! [`rcore`]: crate::rcore use std::convert::identity; diff --git a/src/rstd/typeless.rs b/src/rstd/typeless.rs index d37d518..d11b9c4 100644 --- a/src/rstd/typeless.rs +++ b/src/rstd/typeless.rs @@ -1,5 +1,5 @@ //! Previously part of [`rcore`]. -//! +//! //! [`rcore`]: crate::rcore use super::{cast::CastError, wrapped_origin::*, *};