pub struct GenericRelation {
pub name: &'static str,
pub ct_column: &'static str,
pub pk_column: &'static str,
}Expand description
Generic (“any model”) foreign key declared at the model level —
pairs a content_type_id column with an object_pk column whose
values together identify a row in any registered model. The
pointed-at model varies per row.
Sub-slice F.4 of the v0.15.0 ContentType plan. Used by audit log
targets, comments-on-anything, activity-stream entries, generic
tags. See crate::contenttypes::GenericForeignKey for the
runtime value type and prefetch_generic for batched hydration.
Declared on the source model via the container attr
#[rustango(generic_fk(name = "target", ct_column = "content_type_id", pk_column = "object_pk"))]. The admin renderer uses this metadata
to display generic-FK columns as clickable target links.
Fields§
§name: &'static strLogical name for the relation (used in admin labels, error messages). Free-form Rust identifier.
ct_column: &'static strSource-side column name carrying the content_type_id FK
to rustango_content_types.id.
pk_column: &'static strSource-side column name carrying the target row’s primary key.
Trait Implementations§
Source§impl Clone for GenericRelation
impl Clone for GenericRelation
Source§fn clone(&self) -> GenericRelation
fn clone(&self) -> GenericRelation
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for GenericRelation
impl Debug for GenericRelation
impl Copy for GenericRelation
Auto Trait Implementations§
impl Freeze for GenericRelation
impl RefUnwindSafe for GenericRelation
impl Send for GenericRelation
impl Sync for GenericRelation
impl Unpin for GenericRelation
impl UnsafeUnpin for GenericRelation
impl UnwindSafe for GenericRelation
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
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>
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>
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