Expand description
Lazy loading infrastructure for navigation properties.
Provides the LazyContext trait and LazyContextImpl struct that carry
the information needed to defer-load a navigation property on first
access. Containers (BelongsTo<T> / HasMany<T> / HasOne<T>) hold an
Option<Arc<dyn LazyContext>> and expose an async load() method.
§Recursion guard
A tokio::task_local! depth counter prevents infinite lazy-loading
chains (e.g. Blog → Posts → Blog → ...). The maximum depth is
MAX_LAZY_DEPTH; exceeding it yields
EFError::other("lazy loading recursion limit exceeded").
Structs§
- Lazy
Context Impl - Concrete implementation of
LazyContext.
Constants§
- MAX_
LAZY_ DEPTH - Maximum nesting depth for lazy-loading chains.
Traits§
- Lazy
Context - Context attached to a navigation container enabling deferred loading.
Functions§
- load_
collection_ lazy - Executes a lazy-load query for a collection navigation (HasMany) and returns the materialized entities.
- load_
scalar_ lazy - Executes a lazy-load query for a scalar navigation (BelongsTo / HasOne)
and returns the materialized entity, or
Noneif no matching row.