[−][src]Enum semeion::entity::lifespan::Lifespan
The lifespan of an entity.
Variants
Ephemeral(Span)
The Entity ages as the time goes on, and its lifespan decreases generation after generation.
The Entity is not affected by the passing of time, and its lifespan does not decrease, but it can still be killed by other entities since its lifespan is defined and can be altered.
Implementations
impl Lifespan
[src]
pub fn with_span(span: impl Into<Span>) -> Self
[src]
Constructs an Ephemeral Lifespan with the given span value.
pub fn is_alive(&self) -> bool
[src]
Returns true only if there is lifespan left. It will always return true if immortal.
pub fn shorten(&mut self) -> &Self
[src]
Shorten the lifespan by a single unit of span, it has no effect if immortal. Returns the Lifespan left.
pub fn lengthen(&mut self) -> &Self
[src]
Lengthen the lifespan by a single unit of span, it has no effect if immortal. Returns the Lifespan left.
pub fn shorten_by(&mut self, amount: impl Into<Span>) -> &Self
[src]
Shorten the lifespan by the given amount of span, it has no effect if immortal. Returns the Lifespan left.
pub fn lengthen_by(&mut self, amount: impl Into<Span>) -> &Self
[src]
Lengthen the lifespan by the given amount of span, it has no effect if immortal. Returns the Lifespan left.
pub fn clear(&mut self)
[src]
Replaces the lifespan with a new empty one, by effectively representing the death of the entity. This method will have an effect also on an immortal lifespan.
pub fn span(self) -> Option<Span>
[src]
Gets the Span of the Lifespan if self is Ephemeral, otherwise returns None.
pub fn length(self) -> Option<u64>
[src]
Gets the length of the Lifespan if self is Ephemeral, otherwise returns None.
Trait Implementations
impl Clone for Lifespan
[src]
impl Copy for Lifespan
[src]
impl Debug for Lifespan
[src]
impl Eq for Lifespan
[src]
impl Hash for Lifespan
[src]
pub fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
pub fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl Ord for Lifespan
[src]
pub fn cmp(&self, other: &Lifespan) -> Ordering
[src]
#[must_use]pub fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn clamp(self, min: Self, max: Self) -> Self
1.50.0[src]
impl PartialEq<Lifespan> for Lifespan
[src]
impl PartialOrd<Lifespan> for Lifespan
[src]
pub fn partial_cmp(&self, other: &Lifespan) -> Option<Ordering>
[src]
pub fn lt(&self, other: &Lifespan) -> bool
[src]
pub fn le(&self, other: &Lifespan) -> bool
[src]
pub fn gt(&self, other: &Lifespan) -> bool
[src]
pub fn ge(&self, other: &Lifespan) -> bool
[src]
impl StructuralEq for Lifespan
[src]
impl StructuralPartialEq for Lifespan
[src]
Auto Trait Implementations
impl RefUnwindSafe for Lifespan
impl Send for Lifespan
impl Sync for Lifespan
impl Unpin for Lifespan
impl UnwindSafe for Lifespan
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,