pub struct EntityRef {
pub type_name: String,
pub display: String,
/* private fields */
}Expand description
Reference to an entity involved in a constraint match.
Uses type erasure to allow storing references to different entity types in a single collection.
Fields§
§type_name: StringType name of the entity (e.g., “Shift”, “Employee”).
display: StringString representation for display.
Implementations§
Source§impl EntityRef
impl EntityRef
Sourcepub fn new<T: Clone + Debug + Send + Sync + 'static>(entity: &T) -> Self
pub fn new<T: Clone + Debug + Send + Sync + 'static>(entity: &T) -> Self
Creates a new entity reference from a concrete entity.
Sourcepub fn with_display<T: Clone + Send + Sync + 'static>(
entity: &T,
display: String,
) -> Self
pub fn with_display<T: Clone + Send + Sync + 'static>( entity: &T, display: String, ) -> Self
Creates an entity reference with a custom display string.
Sourcepub fn as_entity<T: 'static>(&self) -> Option<&T>
pub fn as_entity<T: 'static>(&self) -> Option<&T>
Attempts to downcast to the concrete entity type.
Sourcepub fn short_type_name(&self) -> &str
pub fn short_type_name(&self) -> &str
Returns the short type name (without module path).
Trait Implementations§
impl Eq for EntityRef
Auto Trait Implementations§
impl Freeze for EntityRef
impl !RefUnwindSafe for EntityRef
impl Send for EntityRef
impl Sync for EntityRef
impl Unpin for EntityRef
impl !UnwindSafe for EntityRef
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