Skip to main content

open_timeline_core/reduced/
entity.rs

1// SPDX-License-Identifier: MIT
2
3//!
4//! Reduced entity
5//!
6
7use crate::{IsReducedType, Name, OpenTimelineId};
8use serde::{Deserialize, Serialize};
9
10/// The reduced entity type - holds only the [`OpenTimelineId`] and [`Name`] of the
11/// full type
12#[derive(Serialize, Deserialize, Hash, PartialEq, Eq, Debug, Clone, PartialOrd, Ord)]
13pub struct ReducedEntity {
14    id: OpenTimelineId,
15    name: Name,
16}
17
18impl IsReducedType for ReducedEntity {
19    fn from_id_and_name(id: OpenTimelineId, name: Name) -> Self {
20        Self { id, name }
21    }
22
23    fn name(&self) -> &Name {
24        &self.name
25    }
26
27    fn id(&self) -> OpenTimelineId {
28        self.id
29    }
30}