pub struct Entity(/* private fields */);Expand description
Entity datatype
Implementations§
Source§impl Entity
impl Entity
Sourcepub fn new(
uid: EntityUid,
attrs: HashMap<String, RestrictedExpression>,
parents: HashSet<EntityUid>,
) -> Self
pub fn new( uid: EntityUid, attrs: HashMap<String, RestrictedExpression>, parents: HashSet<EntityUid>, ) -> Self
Create a new Entity with this Uid, attributes, and parents.
Attribute values are specified here as “restricted expressions”.
See docs on RestrictedExpression
Sourcepub fn with_uid(uid: EntityUid) -> Self
pub fn with_uid(uid: EntityUid) -> Self
Create a new Entity with this Uid, no attributes, and no parents.
Sourcepub fn attr(&self, attr: &str) -> Option<Result<EvalResult, EvaluationError>>
pub fn attr(&self, attr: &str) -> Option<Result<EvalResult, EvaluationError>>
Get the value for the given attribute, or None if not present.
This can also return Some(Err) if the attribute had an illegal value.
Trait Implementations§
impl Eq for Entity
impl StructuralPartialEq for Entity
Auto Trait Implementations§
impl Freeze for Entity
impl RefUnwindSafe for Entity
impl Send for Entity
impl Sync for Entity
impl Unpin for Entity
impl UnwindSafe for Entity
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.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