Skip to main content

LazyLoader

Trait LazyLoader 

Source
pub trait LazyLoader<M: Model> {
    // Required method
    fn get(
        &mut self,
        cx: &Cx,
        pk: Value,
    ) -> impl Future<Output = Outcome<Option<M>, Error>> + Send;
}
Expand description

Minimal session interface needed to load lazy relationships.

This trait lives in sqlmodel-core to avoid circular dependencies: the concrete Session type is defined in sqlmodel-session (which depends on sqlmodel-core). sqlmodel-session provides the blanket impl.

Required Methods§

Source

fn get( &mut self, cx: &Cx, pk: Value, ) -> impl Future<Output = Outcome<Option<M>, Error>> + Send

Load an object by primary key.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§