Is possible rust-analyzer show how arguments satisfy the function requirements?

Example:
https://docs.rs/axum/0.2.8/axum/index.html#example

axum::Server::bind(&"0.0.0.0:3000".parse().unwrap())
    .serve(app.into_make_service())
    .await
    .unwrap();

serve method require a type implement trait MakeServiceRef, app.into_make_service() return a IntoMakeService struct.

If rust-analyzer can show how IntoMakeService convert to MakeServiceRef would be great. It's will really helpful to understand how the code worked.

Rust doesn't have implicit conversions, which means that IntoMakeService must implement MakeServiceRef.

I don't believe rust-analyzer has any functionality for seeing how a type implements a given trait. In most cases you can open the docs for your project using cargo doc --open and navigate to a type to see all of the traits it implements. The docs have links to the source where the trait implementation is, though in cases where macros are involved it may not be that straightforward.

In this specific case I don't think it'll show up in the docs at all since MakeServiceRef is a "sealed" trait, meaning it is private. In such cases reading the source is probably your best bet.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.