I am having a little trouble using Rocket, I am not sure this problem is related to Rocket.
pub struct Webhook<M: MyTrait> {
address: String,
port: i16,
xxmm: Arc<M>,
}
impl<M: MyTrait + 'static> Webhook<M> {
pub async fn start(&self) -> anyhow::Result<()> {
rocket::build()
.manage(self.xxmm.clone())
.mount(
"/",
routes![get_root]
)
.launch()
.await?;
Ok(())
}
}
#[get("/")]
fn get_root<M>(
xxmm: &State<Arc<M>>, // Here I got the error: cannot find type `M` in this scope
_header_check: GetHeadersCheck,
) -> (ContentType, Json<MyObj>)
where
M: MyTrait,
{
todo!();
}