DuskSystems / wayfind

A speedy, flexible router for Rust.
Apache License 2.0
10 stars 0 forks source link

Consider using Arc for shared data, rather than HashMap #150

Closed CathalMullan closed 1 month ago

CathalMullan commented 1 month ago

This would probably work:

#[derive(Clone, Debug, Eq, PartialEq)]
pub enum NodeData<T> {
    /// Data is stored inline.
    Inline {
        /// The original route.
        route: Arc<str>,

        /// The associated data.
        value: T,
    },

    /// Data is shared between 2 or more nodes.
    Shared {
        /// The original route.
        route: Arc<str>,

        /// The expanded route.
        expanded: Arc<str>,

        /// The associated data, shared.
        value: Arc<T>,
    },
}