struct Node {
prefix: Arc<[u8]>
}
struct Param<'v> {
key: BytesStr,
value: &'v u8
}
struct BytesStr(Arc<[u8]>);
impl ByteStr {
fn as_str(&self) -> &str {
std::str::from_utf8(&self.0[1..]).unwrap()
}
}
A trade off between less lifetime and reference counted overhead + an extra public type. Current Param(s) type are pretty hard to use if not consumed inline. From what I see most people would do an extra heap allocation to erase the lifetime(s) so in that case this would likely be cheaper.
A trade off between less lifetime and reference counted overhead + an extra public type. Current Param(s) type are pretty hard to use if not consumed inline. From what I see most people would do an extra heap allocation to erase the lifetime(s) so in that case this would likely be cheaper.