Re:A Week with Mozilla's Rust
by dbaupp on Wednesday August 21, 2013 @08:29PM
(#6254278)
You can use lifetimes to enforce that a certain thing is static data, and combined with an enum, you get the best of both worlds: compile-time constants require no allocations, but still flexible enough to allow run-time construction:
and then `error` would take `StringRef` and be called like:
(There was even a pull request that added this and the corresponding one for vectors to the stdlib, but it didn't landed (yet): https://github.com/mozilla/rust/pull/7599)
[ Parent
| on HN ]
There are no comments on this comment yet.