hgame 0.26.4

CG production management structs, e.g. of assets, personnels, progress, etc.
Documentation
use super::*;
#[cfg(feature = "stage_graph")]
use crate::stage::AssetStage;

#[async_trait]
pub trait AssetExt: DynClone + fmt::Debug + Send + Sync {
    /// Gets assignees of the given asset.
    async fn assignees(
        &mut self,
        project: &Project,
        asset: &ProductionAsset,
    ) -> Result<Vec<Staff>, DatabaseError>;

    /// Gets statuses of the given asset.
    async fn statuses(
        &mut self,
        project: &Project,
        asset: &ProductionAsset,
    ) -> Result<Vec<AssetStatus>, DatabaseError>;

    /// Updates statuses for the asset, given that the specified `StatusAction` has been taken place.
    /// Returns the modified [`ProductionAsset`].
    async fn status_action_mut(
        &mut self,
        project: &Project,
        asset: &ProductionAsset,
        action: StatusAction,
    ) -> Result<(), ModificationError>;

    fn clear_cache(&mut self) {}
}

dyn_clone::clone_trait_object!(AssetExt);

// -------------------------------------------------------------------------------
#[cfg(feature = "stage_graph")]
/// Combination of two traits, to handle both statuses and stages.
pub trait TrackedAsset: AssetExt + AssetStage {}

#[cfg(not(feature = "stage_graph"))]
pub trait TrackedAsset: AssetExt {}

dyn_clone::clone_trait_object!(TrackedAsset);