by poincaredisk · 1y ago · 0 comments
This is an extreme example, but the same thing happens very often at a smaller scale. Optional functionality can't always be removed statically.
let uri = get_uri_from_stdin();
networking_library::make_request(uri);
How is the compiler supposed to prune that? let uri: Uri<HTTP> = get_uri_from_stdin().parse()?;
If the library is made in a modular way this is how it would typically be done. The `HTTP` may be inferred by calls further along in the function.Rust does have a feature flagging system for this kind of optional functionality though. It's not perfect, but it would work very well for something like curl protocol backends though.