pub struct HasOne<T> { /* private fields */ }Expand description
Represents a “has-one” navigation - ?a single related entity where the foreign key lives on the other side.
Implementations§
Source§impl<T> HasOne<T>
impl<T> HasOne<T>
pub fn new() -> Self
pub fn with(entity: T) -> Self
pub fn get(&self) -> Option<&T>
pub fn get_mut(&mut self) -> Option<&mut T>
Sourcepub fn take(&mut self) -> Option<T>
pub fn take(&mut self) -> Option<T>
Extracts the related entity, leaving the container empty and unloaded. Used by batch nested-include loading to collect related entities across multiple parents into a single slice for batch SQL.
Sourcepub fn set_lazy_context(&mut self, ctx: Arc<dyn LazyContext>)
pub fn set_lazy_context(&mut self, ctx: Arc<dyn LazyContext>)
Attaches a lazy-loading context to this container.
Trait Implementations§
Auto Trait Implementations§
impl<T> !RefUnwindSafe for HasOne<T>
impl<T> !UnwindSafe for HasOne<T>
impl<T> Freeze for HasOne<T>
impl<T> Send for HasOne<T>where
T: Send,
impl<T> Sync for HasOne<T>where
T: Sync,
impl<T> Unpin for HasOne<T>where
T: Unpin,
impl<T> UnsafeUnpin for HasOne<T>
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