pub trait LazyContext: Send + Sync {
// Required methods
fn provider(&self) -> &Arc<dyn IDatabaseProvider>;
fn owner_snapshot(&self) -> &HashMap<String, DbValue>;
fn owner_key_values(&self) -> &HashMap<String, DbValue>;
fn navigation(&self) -> &NavigationMeta;
fn filter_map(&self) -> Option<&HashMap<String, CompiledFilter>>;
fn depth(&self) -> usize;
}Expand description
Context attached to a navigation container enabling deferred loading.
Stored as Arc<dyn LazyContext> inside BelongsTo<T> / HasMany<T> /
HasOne<T>. The context carries everything load() needs to build and
execute a single-entity navigation query:
- The database provider (for connection + SQL generation)
- The owning entity’s primary-key values and full property snapshot
- The
NavigationMetadescribing which navigation to load - Optional global query filters (e.g. tenant isolation)
- The current recursion depth (for cycle detection)
Implemented by LazyContextImpl; users can provide custom
implementations for advanced scenarios (e.g. custom caching).
Required Methods§
Sourcefn provider(&self) -> &Arc<dyn IDatabaseProvider>
fn provider(&self) -> &Arc<dyn IDatabaseProvider>
The database provider used to execute the lazy-load query.
Sourcefn owner_snapshot(&self) -> &HashMap<String, DbValue>
fn owner_snapshot(&self) -> &HashMap<String, DbValue>
The owning entity’s full property snapshot (field_name → value).
Used to extract foreign-key values for BelongsTo navigations.
Sourcefn owner_key_values(&self) -> &HashMap<String, DbValue>
fn owner_key_values(&self) -> &HashMap<String, DbValue>
The owning entity’s primary-key values (field_name → value).
Used to extract principal-key values for HasMany / HasOne
navigations.
Metadata describing the navigation to lazy-load.
Sourcefn filter_map(&self) -> Option<&HashMap<String, CompiledFilter>>
fn filter_map(&self) -> Option<&HashMap<String, CompiledFilter>>
Optional global query filters keyed by table name.
Applied to the related table’s query so lazy-loaded data respects the same scoping (e.g. tenant isolation) as top-level queries.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".