wesichain-graph 0.3.0

Rust-native LLM agents & chains with resumable ReAct workflows
Documentation
use std::collections::HashMap;

pub struct AppendVec;
impl AppendVec {
    pub fn merge<T: Clone>(current: &[T], mut update: Vec<T>) -> Vec<T> {
        let mut out = current.to_vec();
        out.append(&mut update);
        out
    }
}

pub struct MergeMap;
impl MergeMap {
    pub fn merge<K: Eq + std::hash::Hash + Clone, V: Clone>(
        current: &HashMap<K, V>,
        update: HashMap<K, V>,
    ) -> HashMap<K, V> {
        let mut out = current.clone();
        out.extend(update);
        out
    }
}

pub struct AddCounter;
impl AddCounter {
    pub fn merge(current: &i64, update: i64) -> i64 {
        current + update
    }
}

pub struct Override;
impl Override {
    pub fn merge<T>(_current: &T, update: T) -> T {
        update
    }
}