Skip to main content

Module lazy

Module lazy 

Source
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§

LazyContextImpl
Concrete implementation of LazyContext.

Constants§

MAX_LAZY_DEPTH
Maximum nesting depth for lazy-loading chains.

Traits§

LazyContext
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 None if no matching row.