# Static-analysis friendly scoped APIs ## What's the common API pattern ### Failure modes # Dynamic APIs still with dependency ## On process-level resources: `std::io::stdin()` and `std::io::Stdin`: ## On thread-level resources: `rand::random()` and `rand::ThreadRng`: ## Reference counting and interior mutability ## More approaches? # How to share code as much as possible if your crate wants to support both or more.
Static-analysis friendly scoped APIs
What's the common API pattern
Failure modes
Dynamic APIs still with dependency
On process-level resources:
std::io::stdin()andstd::io::Stdin:On thread-level resources:
rand::random()andrand::ThreadRng:Reference counting and interior mutability
More approaches?
How to share code as much as possible if your crate wants to support both or more.