pub struct RecordWriter<'a> { /* private fields */ }Expand description
Helper for writing record (map with string keys) to Eure documents.
Used within the closure passed to DocumentConstructor::record.
§Example
ⓘ
c.record(|rec| {
rec.field("name", "Alice")?;
rec.field_optional("age", Some(30))?;
Ok(())
})?;Implementations§
Source§impl<'a> RecordWriter<'a>
impl<'a> RecordWriter<'a>
Sourcepub fn field<T: IntoDocument>(
&mut self,
name: &str,
value: T,
) -> Result<(), WriteError>
pub fn field<T: IntoDocument>( &mut self, name: &str, value: T, ) -> Result<(), WriteError>
Sourcepub fn field_optional<T: IntoDocument>(
&mut self,
name: &str,
value: Option<T>,
) -> Result<(), WriteError>
pub fn field_optional<T: IntoDocument>( &mut self, name: &str, value: Option<T>, ) -> Result<(), WriteError>
Sourcepub fn field_with<F, T>(&mut self, name: &str, f: F) -> Result<T, WriteError>
pub fn field_with<F, T>(&mut self, name: &str, f: F) -> Result<T, WriteError>
Sourcepub fn field_with_optional<T, F, R>(
&mut self,
name: &str,
value: Option<T>,
f: F,
) -> Result<Option<R>, WriteError>
pub fn field_with_optional<T, F, R>( &mut self, name: &str, value: Option<T>, f: F, ) -> Result<Option<R>, WriteError>
Sourcepub fn constructor(&mut self) -> &mut DocumentConstructor
pub fn constructor(&mut self) -> &mut DocumentConstructor
Get a mutable reference to the underlying DocumentConstructor.
Useful for advanced use cases that need direct access.
Auto Trait Implementations§
impl<'a> Freeze for RecordWriter<'a>
impl<'a> RefUnwindSafe for RecordWriter<'a>
impl<'a> Send for RecordWriter<'a>
impl<'a> Sync for RecordWriter<'a>
impl<'a> Unpin for RecordWriter<'a>
impl<'a> !UnwindSafe for RecordWriter<'a>
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