pub struct Entity { /* private fields */ }Expand description
The OpenTimeline Entity type
Implementations§
Source§impl Entity
impl Entity
Sourcepub fn from(
id: Option<OpenTimelineId>,
name: Name,
start: Date,
end: Option<Date>,
tags: Option<Tags>,
) -> Result<Entity, EntityError>
pub fn from( id: Option<OpenTimelineId>, name: Name, start: Date, end: Option<Date>, tags: Option<Tags>, ) -> Result<Entity, EntityError>
Create a valid OpenTimeline Entity if it is possible to do so with
the values passed in
Borrow the entity’s Tags
Mutably borrow the entity’s Tags
Sourcepub fn remove_tag(&mut self, tag: &Tag)
pub fn remove_tag(&mut self, tag: &Tag)
Remove a tag from the entity
Set the entity’s Tags
Clear the entity’s Tags and set to None
Sourcepub fn set_start(&mut self, start: Date) -> Result<(), EntityError>
pub fn set_start(&mut self, start: Date) -> Result<(), EntityError>
Set the entity’s start Date if it’ll be valid
Sourcepub fn set_end(&mut self, end: Date) -> Result<(), EntityError>
pub fn set_end(&mut self, end: Date) -> Result<(), EntityError>
Set the entity’s end Date if it’ll be valid
Sourcepub fn end_year_is_set(&self) -> bool
pub fn end_year_is_set(&self) -> bool
Check if the entity’s end year is set
Sourcepub fn start_year(&self) -> Year
pub fn start_year(&self) -> Year
Check if the entity’s start year is set
Sourcepub fn start_month(&self) -> Option<Month>
pub fn start_month(&self) -> Option<Month>
Check if the entity’s start month is set
Sourcepub fn matches_bool_tag_expr(&self, bool_tag_expr: &BoolTagExpr) -> bool
pub fn matches_bool_tag_expr(&self, bool_tag_expr: &BoolTagExpr) -> bool
Whether the entity in question matches the boolean tag expression. This can be used to filter a list of entities by a boolean tag expression.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Entity
impl<'de> Deserialize<'de> for Entity
Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl HasIdAndName for Entity
impl HasIdAndName for Entity
Source§fn id(&self) -> Option<OpenTimelineId>
fn id(&self) -> Option<OpenTimelineId>
Get the ID
Source§fn set_id(&mut self, id: OpenTimelineId)
fn set_id(&mut self, id: OpenTimelineId)
Set the ID - the
OpenTimelineId passed in must have been
initialised, and therefore is guaranteed to be validSource§impl Ord for Entity
impl Ord for Entity
Source§impl PartialOrd for Entity
impl PartialOrd for Entity
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 UnsafeUnpin 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