\@steveklabnik this is the set of things I tried to remove Option from Option<Box<dyn State>> in that example I mentioned yesterday:
https://gist.github.com/jcoglan/2c253feabfec2ed51573872969db48d8 …
assume the final version here isn't common due to need to return `self`?
-
-
Replying to @mountain_ghosts @steveklabnik
Using ownership to enforce state transitions is super common , although usually it's by changing an external type rather than an internal As an aside, Boxing a zero size type is a type-level hack, that should be entirely stripped in the artifact output.
2 replies 0 retweets 1 like -
Replying to @myrrlyn @steveklabnik
sure, but in real-world code I would expect the structs to contain data and therefore allocate though I can see the value in using zero-size types purely as a compile-time modelling thing
2 replies 0 retweets 1 like
You can get pretty far with zero sized types. :) https://github.com/diesel-rs/diesel/blob/50798e5dd52ae9d3c7c9a4bf7a5f1e5b9167aba3/diesel_tests/tests/perf_details.rs#L8-L16 …
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.