someguynamedjosh / ouroboros

Easy self-referential struct generation for Rust.
Apache License 2.0
535 stars 34 forks source link

Add a way to not double box items #87

Open krishna-selectstar opened 1 year ago

krishna-selectstar commented 1 year ago

I'm currently using ouroboros store some strings with their parsed equivalents like this:

#[self_referencing]
struct Data {
    text: String,
    #[covariant]
    #[borrows(text)]
    parsed: Ast<'this>
}

And I would like to avoid double boxing the string. Is there a way that I could use AliasedString, add an annotation and have it be unboxed, like this?

#[self_referencing]
struct Data {
    #[unboxed]
    text: AliasedString,
    #[covariant]
    #[borrows(text)]
    parsed: Ast<'this>
}