How to identify std futures crates vs old futures crates?

On I'd like to add compatibility badges for Futures-using crates, classifying them as either 0.1-compatible or std-compatible, so that users of either ecosystem don't run into unexpected incompatibilities.

However, I wonder what would be the most reliable (and reasonably easy to implement) way of detecting whether a crate is a "std" or "0.1" compatible?

  • Looking for futures 0.1 dependency seems easiest, but it's not guaranteed to be accurate. A crate may use it only internally and not expose it as a public interface. Or it can use it to provide a compatibility shim and support both 0.1 and std.

  • I could search code for "std::future" and assume this means the crate is for the new futures. I could maybe use rls/save-analysis to make it more precise.

  • Asking authors to add badges/metadata is out, since I'd like this to work with all relevant crates.

Any other ideas?


Another thing to keep in mind for those who help solve this problem. Sometimes, a single crate may have both 0.1 and new futures (in my case):

futures2 = { version = "=0.3.0-alpha.18", features = ["compat", "nightly"], package = "futures-preview" }
futures = "0.1.29"
1 Like

I don't think of searching in Cargo.lock or for use keywords as a valid method to handle it. You can develop a crate to check futures-awareness by using its functions and methods. tokio-awareness might also be an interest to the community. I would be happy if I can contribute to such projects.

I'm not sure what method you're proposing here.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.