pub struct RelationRegistry { /* private fields */ }Expand description
Relation lookup tables for one snapshot of the admin registration.
Implementations§
Source§impl RelationRegistry
impl RelationRegistry
Sourcepub fn from_admin_entries(entries: &[AdminEntry]) -> Self
pub fn from_admin_entries(entries: &[AdminEntry]) -> Self
Build the registry from the current admin entries. Silent on
unknown targets / display fields — call validate
after if you want those surfaced as errors.
Sourcepub fn belongs_to(&self, model: &str, field: &str) -> Option<&ResolvedRelation>
pub fn belongs_to(&self, model: &str, field: &str) -> Option<&ResolvedRelation>
The ResolvedRelation for (model, field), if any.
Sourcepub fn belongs_to_of(&self, model: &str) -> &[ResolvedRelation]
pub fn belongs_to_of(&self, model: &str) -> &[ResolvedRelation]
Every forward relation owned by a source model.
Sourcepub fn has_many(&self, model: &str) -> &[InverseRelation]
pub fn has_many(&self, model: &str) -> &[InverseRelation]
Every incoming edge into model. Used by the inverse-panel
renderer and the delete guard.
Sourcepub fn validate(&self, entries: &[AdminEntry]) -> Vec<RegistryError>
pub fn validate(&self, entries: &[AdminEntry]) -> Vec<RegistryError>
Walk every stored relation and report declarations that reference models or columns not present in the current admin.
Sourcepub fn iter_belongs_to(&self) -> impl Iterator<Item = &ResolvedRelation>
pub fn iter_belongs_to(&self) -> impl Iterator<Item = &ResolvedRelation>
A forward iterator over every ResolvedRelation in the registry, in deterministic order.
Trait Implementations§
Source§impl Clone for RelationRegistry
impl Clone for RelationRegistry
Source§fn clone(&self) -> RelationRegistry
fn clone(&self) -> RelationRegistry
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for RelationRegistry
impl Debug for RelationRegistry
Source§impl Default for RelationRegistry
impl Default for RelationRegistry
Source§fn default() -> RelationRegistry
fn default() -> RelationRegistry
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for RelationRegistry
impl RefUnwindSafe for RelationRegistry
impl Send for RelationRegistry
impl Sync for RelationRegistry
impl Unpin for RelationRegistry
impl UnsafeUnpin for RelationRegistry
impl UnwindSafe for RelationRegistry
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more