From b255dfaf611f492f18a6c76ce6562bf0649273bb Mon Sep 17 00:00:00 2001 From: Temirkhan Myrzamadi Date: Sun, 26 Jul 2020 04:43:08 +0600 Subject: [PATCH] Document UpState --- src/up_state.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/up_state.rs b/src/up_state.rs index 698e32ab..67b3e43e 100644 --- a/src/up_state.rs +++ b/src/up_state.rs @@ -1,6 +1,14 @@ #[cfg(feature = "frunk")] use frunk::{from_generic, generic::Generic, hlist::HAppender, into_generic}; +/// Constructs a structure from another structure and a field. +/// +/// Let `X` be a structure of `field1, ..., fieldN`, `Y` be `field1, ..., +/// fieldN, fieldN+1`. Both `X` and `Y` implement [`Generic`]. Then `Y::up(x, +/// fieldN+1)` constructs `Y` from all the fields of `x: X` plus `Y`'s +/// `fieldN+1`. +/// +/// [`Generic`]: https://docs.rs/frunk/latest/frunk/generic/trait.Generic.html #[cfg(feature = "frunk")] pub trait UpState: Sized { fn up(src: T1, field: F) -> Self