3 ms·
This is ultimately a good example of how to use Rust. You express as much of the API as you can safely, and the rest is unsafe. APIs that can't be safely modell
by dwattttt 11mo ago
This is ultimately a good example of how to use Rust. You express as much of the API as you can safely, and the rest is unsafe. APIs that can't be safely modelled can still be exposed to Rust & marked unsafe, if they're needed
- accelbred 11mo agoThat works for functions. For datatypes that are used throughout the API, it does not work so well.
- dwattttt 11mo agoWouldn't a data type with no safe method of construction satisfy that? You can only get one by calling an unsafe function & satisfying its constraints.
- accelbred 11mo agoThat would be possible but also make its usage unergonomic and not the experience customers are expecting when requesting a Rust API.