Mode::bind/Mode::map docs

This commit is contained in:
AF 2023-07-30 13:53:36 +00:00
parent 37a38f5c2a
commit 44c04431a8
3 changed files with 12 additions and 2 deletions

View File

@ -34,11 +34,21 @@ pub trait Mode {
/// See [`FactoryParse::extend`].
type ExtensionSource<A>;
/// 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<A0, A1, E, I>(
s: Self::ParseSuccess<A0, I>,
f: impl FnOnce(A0) -> Result<A1, E>,
) -> ModeResult<Self, A1, E, I>;
/// Map the successfully parsed value.
///
/// See also [`Mode::bind`]
fn map<A0, A1, I>(
s: Self::ParseSuccess<A0, I>,
f: impl FnOnce(A0) -> A1,