pub enum RecordRowsF<Ty, RRows> {
Empty,
Extend {
row: RecordRowF<Ty>,
tail: RRows,
},
TailVar(LocIdent),
TailDyn,
}Expand description
Generic sequence of record rows potentially with a type variable or Dyn in tail position.
As other types with the F suffix, this type is parametrized by one or more recursive
unfoldings. See TypeF for more details.
§Type parameters
Tyis the recursive unfolding of a Nickel type stored inside one row. In practice, a wrapper around an instantiation ofTypeF.RRowsis the recursive unfolding of record rows (the tail of this row sequence). In practice, a wrapper around an instantiation ofRecordRowsF.
Variants§
Implementations§
Source§impl<Ty, RRows> RecordRowsF<Ty, RRows>
impl<Ty, RRows> RecordRowsF<Ty, RRows>
Sourcepub fn try_map_state<TyO, RRowsO, FTy, FRRows, S, E>(
self,
f_ty: FTy,
f_rrows: FRRows,
state: &mut S,
) -> Result<RecordRowsF<TyO, RRowsO>, E>
pub fn try_map_state<TyO, RRowsO, FTy, FRRows, S, E>( self, f_ty: FTy, f_rrows: FRRows, state: &mut S, ) -> Result<RecordRowsF<TyO, RRowsO>, E>
Map functions over the children nodes of record rows, when seen as a tree. The mutable
state ( S) is threaded through the calls to the mapped functions. Functions are fallible
and may return an error E, which causes try_map_state to return early with the same
error.
If we put aside the state and the error (see [RecordRowsF::map), this function makes
RecordRowsF a functor (of arity 2). As hinted by the type signature, this function just
maps on “one-level” of recursion, so to speak. Take the instantiated version RecordRows,
and record rows of the form {foo : T, bar: U, baz: V}. Then, calling try_map_state(f_ty, f_rrows, state) on these rows will map f_ty onto T and f_rrows onto {bar : U, baz: V}.
Note that f_ty isn’t mapped onto U and V recursively: map isn’t a recursive
operation. It’s however a building block to express recursive operations: as an example,
see crate::ast::typ::RecordRows::traverse.
Sourcepub fn try_map<TyO, RRowsO, FTy, FRRows, E>(
self,
f_ty: FTy,
f_rrows: FRRows,
) -> Result<RecordRowsF<TyO, RRowsO>, E>
pub fn try_map<TyO, RRowsO, FTy, FRRows, E>( self, f_ty: FTy, f_rrows: FRRows, ) -> Result<RecordRowsF<TyO, RRowsO>, E>
Variant of try_map_state without threaded state.
Sourcepub fn map_state<TyO, RRowsO, FTy, FRRows, S>(
self,
f_ty: FTy,
f_rrows: FRRows,
state: &mut S,
) -> RecordRowsF<TyO, RRowsO>
pub fn map_state<TyO, RRowsO, FTy, FRRows, S>( self, f_ty: FTy, f_rrows: FRRows, state: &mut S, ) -> RecordRowsF<TyO, RRowsO>
Variant of try_map_state with infallible functions.
Sourcepub fn map<TyO, RRowsO, FTy, FRRows>(
self,
f_ty: FTy,
f_rrows: FRRows,
) -> RecordRowsF<TyO, RRowsO>
pub fn map<TyO, RRowsO, FTy, FRRows>( self, f_ty: FTy, f_rrows: FRRows, ) -> RecordRowsF<TyO, RRowsO>
Variant of try_map_state without threaded state and with infallible functions.
Trait Implementations§
Source§impl<Ty: Clone, RRows: Clone> Clone for RecordRowsF<Ty, RRows>
impl<Ty: Clone, RRows: Clone> Clone for RecordRowsF<Ty, RRows>
Source§fn clone(&self) -> RecordRowsF<Ty, RRows>
fn clone(&self) -> RecordRowsF<Ty, RRows>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<Ty: CloneTo, RRows: CloneTo> CloneTo for RecordRowsF<Ty, RRows>
impl<Ty: CloneTo, RRows: CloneTo> CloneTo for RecordRowsF<Ty, RRows>
impl<Ty: Eq, RRows: Eq> Eq for RecordRowsF<Ty, RRows>
impl<Ty, RRows> StructuralPartialEq for RecordRowsF<Ty, RRows>
Auto Trait Implementations§
impl<Ty, RRows> Freeze for RecordRowsF<Ty, RRows>
impl<Ty, RRows> RefUnwindSafe for RecordRowsF<Ty, RRows>where
RRows: RefUnwindSafe,
Ty: RefUnwindSafe,
impl<Ty, RRows> Send for RecordRowsF<Ty, RRows>
impl<Ty, RRows> Sync for RecordRowsF<Ty, RRows>
impl<Ty, RRows> Unpin for RecordRowsF<Ty, RRows>
impl<Ty, RRows> UnsafeUnpin for RecordRowsF<Ty, RRows>where
RRows: UnsafeUnpin,
Ty: UnsafeUnpin,
impl<Ty, RRows> UnwindSafe for RecordRowsF<Ty, RRows>where
RRows: UnwindSafe,
Ty: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more