code0-flow 0.0.30

Crate for managing the code0-flows inside of the Flow Queue & FlowStore
Documentation
use tucana::shared::{DefinitionDataType, FlowType, FunctionDefinition, RuntimeFunctionDefinition};

pub trait HasVersion {
    fn version(&self) -> &String;

    fn is_accepted(&self, filter: &Option<String>) -> bool {
        filter
            .as_ref()
            .is_none_or(|v| self.version() == v)
    }
}

impl HasVersion for DefinitionDataType {
    fn version(&self) -> &String {
        &self.version
    }
}

impl HasVersion for FlowType {
    fn version(&self) -> &String {
        &self.version
    }
}

impl HasVersion for FunctionDefinition {
    fn version(&self) -> &String {
        &self.version
    }
}
impl HasVersion for RuntimeFunctionDefinition {
    fn version(&self) -> &String {
        &self.version
    }
}