4
jestdotty
15h

*tries to avoid using refcells* fuuuuuck

all cuz serde can't serialize them well but I can build a custom serializer/deserializer. I'm not sure this constraint is worth it

on one hand I would love to just build something entirely in enums with no traits or RC or refcell but on the other hand this is proving to be too hard

Comments
  • 4
    oh nevermind seems it was the rc they were wrapped in previously

    excellent

    but still. apparently you're not supposed to use them
  • 2
    I've learnt stuff. Refcells and Serde.
  • 1
    @jestdotty You maybe already know but serde allows you to declare foreign implementations for types

    So if you have RefCell<T> you can write your own serialize logic (which locks the refcell and then calls the default serialize method on the inner type) and attach it via #[serde(serialize_with = "path")]
Add Comment