pub struct Record<'a, S: Schema> { /* private fields */ }Expand description
A resource object under construction. Created by Serializer::record.
Implementations§
Source§impl<S: Schema> Record<'_, S>
impl<S: Schema> Record<'_, S>
Sourcepub fn attrs(
self,
attributes: impl IntoIterator<Item = (String, Value)>,
) -> Self
pub fn attrs( self, attributes: impl IntoIterator<Item = (String, Value)>, ) -> Self
Set every attribute at once, from a record’s own data.
Sourcepub fn rel(self, name: impl Into<String>, id: impl Into<String>) -> Self
pub fn rel(self, name: impl Into<String>, id: impl Into<String>) -> Self
Link a to-one relationship. The target type comes from the schema.
Sourcepub fn rel_many(
self,
name: impl Into<String>,
ids: impl IntoIterator<Item = String>,
) -> Self
pub fn rel_many( self, name: impl Into<String>, ids: impl IntoIterator<Item = String>, ) -> Self
Link a to-many relationship.
Sourcepub fn build(self) -> ResourceObject
pub fn build(self) -> ResourceObject
Finish the resource object.
Consumes the builder’s own maps rather than handing
serialize a reference to them: the linkage
ids are moved onto the resource object instead of being cloned out of
a map that is about to be dropped.
Auto Trait Implementations§
impl<'a, S> Freeze for Record<'a, S>
impl<'a, S> RefUnwindSafe for Record<'a, S>where
&'a S: RefUnwindSafe,
impl<'a, S> Send for Record<'a, S>
impl<'a, S> Sync for Record<'a, S>
impl<'a, S> Unpin for Record<'a, S>
impl<'a, S> UnsafeUnpin for Record<'a, S>where
&'a S: UnsafeUnpin,
impl<'a, S> UnwindSafe for Record<'a, S>where
&'a S: 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
Mutably borrows from an owned value. Read more