pub struct Record<'ast> { /* private fields */ }Expand description
A Nickel record being constructed
Implementations§
Source§impl<'ast> Record<'ast>
impl<'ast> Record<'ast>
Sourcepub fn field(self, name: impl AsRef<str>) -> Field<'ast, Record<'ast>>
pub fn field(self, name: impl AsRef<str>) -> Field<'ast, Record<'ast>>
Start constructing a field with the given name
Sourcepub fn fields<I, It>(self, alloc: &'ast AstAlloc, fields: It) -> Self
pub fn fields<I, It>(self, alloc: &'ast AstAlloc, fields: It) -> Self
Attach possibly multiple fields to this record
Sourcepub fn include(self, ident: LocIdent) -> Self
pub fn include(self, ident: LocIdent) -> Self
Adds an include expression (define a field by taking it from the outer environment).
Sourcepub fn include_with_metadata(
self,
ident: LocIdent,
metadata: FieldMetadata<'ast>,
) -> Self
pub fn include_with_metadata( self, ident: LocIdent, metadata: FieldMetadata<'ast>, ) -> Self
Adds an include expression with associated metadata.
Sourcepub fn path<It, I>(self, path: It) -> Field<'ast, Record<'ast>>
pub fn path<It, I>(self, path: It) -> Field<'ast, Record<'ast>>
Start constructing a field at the given path
Sourcepub fn set_open(self, open: bool) -> Self
pub fn set_open(self, open: bool) -> Self
Mark this record as “open” when used as a contract, depending on the value of open
Sourcepub fn build(self, alloc: &'ast AstAlloc) -> Ast<'ast>
pub fn build(self, alloc: &'ast AstAlloc) -> Ast<'ast>
Finalize the record and turn it into a super::Ast
Sourcepub fn from_iterator<I, It>(alloc: &'ast AstAlloc, fields: It) -> Self
pub fn from_iterator<I, It>(alloc: &'ast AstAlloc, fields: It) -> Self
Creates a record from an iterator of finalized fields.
We can’t implement FromIterator for Record because we need to provide an additional
allocator.
Trait Implementations§
Auto Trait Implementations§
impl<'ast> Freeze for Record<'ast>
impl<'ast> RefUnwindSafe for Record<'ast>
impl<'ast> Send for Record<'ast>
impl<'ast> Sync for Record<'ast>
impl<'ast> Unpin for Record<'ast>
impl<'ast> UnsafeUnpin for Record<'ast>
impl<'ast> UnwindSafe for Record<'ast>
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
Mutably borrows from an owned value. Read more
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>
Converts
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>
Converts
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