DuskSystems / wayfind

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

Consider using Arc for all data storage #152

Closed CathalMullan closed 1 week ago

CathalMullan commented 1 week ago

Would the overhead result in a simpler API? Let's experiment.

UPDATE: Changing the Match response to:

#[derive(Debug, Eq, PartialEq)]
pub struct Match<T> {
    /// The matching route.
    pub route: Arc<str>,

    /// A reference to the matching route data.
    pub data: Arc<T>,

    /// Key-value pairs of parameters, extracted from the route.
    pub parameters: Vec<Parameter>,
}

Results in a 100% slowdown. Albeit, the API is much nicer without the lifetimes.

Not worth.