A provider that contributes virtual members to a class. Receives the class with traits and parents already merged (via [`resolve_class_with_inheritance`](crate::inheritance::resolve_class_with_inheritance)), but **without** other providers' contributions. This prevents circular loading when one provider's output would trigger another provider. Implementations must be cheap to construct and stat
| 319 | /// contextual information is passed through the `class` and |
| 320 | /// `class_loader` arguments. |
| 321 | pub trait VirtualMemberProvider { |
| 322 | /// Whether this provider has anything to say about this class. |
| 323 | /// |
| 324 | /// This is a cheap pre-check so the resolver can skip providers |
| 325 | /// early without calling [`provide`](Self::provide). Returning |
| 326 | /// `false` means [`provide`](Self::provide) will not be called. |
| 327 | fn applies_to( |
| 328 | &self, |
| 329 | class: &ClassInfo, |
| 330 | class_loader: &dyn Fn(&str) -> Option<Arc<ClassInfo>>, |
| 331 | ) -> bool; |
| 332 | |
| 333 | /// Produce virtual members for this class. |
| 334 | /// |
| 335 | /// Only called when [`applies_to`](Self::applies_to) returned `true`. |
| 336 | /// The returned members are merged into the class below all real |
| 337 | /// declared members (own, trait, and parent chain). |
| 338 | /// |
| 339 | /// `cache` is the shared resolved-class cache. Providers that need |
| 340 | /// to fully resolve helper classes (e.g. the Laravel model provider |
| 341 | /// resolving the Eloquent Builder) should use |
| 342 | /// [`resolve_class_fully_cached`] via this cache to avoid redundant |
| 343 | /// work across requests. |
| 344 | fn provide( |
| 345 | &self, |
| 346 | class: &ClassInfo, |
| 347 | class_loader: &dyn Fn(&str) -> Option<Arc<ClassInfo>>, |
| 348 | cache: Option<&ResolvedClassCache>, |
| 349 | ) -> VirtualMembers; |
| 350 | } |
| 351 | |
| 352 | /// Merge virtual members into a resolved `ClassInfo`. |
| 353 | /// |
nothing calls this directly
no outgoing calls
no test coverage detected