title: How can I pass structs from an Actix middleware to the handler?
body: <p>I'm trying to write an authentication middleware for my Actix application. When validating the request in the middleware, I make a call to a database to retrieve the necessary user data to validate the incoming request. Once the request has been authorised, I want to be able to pass this user data to the handler as this will allow me to avoid having the query for the same data twice.</p>
  <p>I can't find a solution for this. The best suggestion I could find so far was to <a href="https://github.com/actix/actix-web/issues/855" rel="noreferrer">&quot;set a request extension&quot;</a>. There doesn't seem to be any examples for this and there is also too little documentation around this to work out what to do here.</p>