Axum handler type mismatched when d1 is invoked #698
Unanswered
ChihweiLHBird
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Updated question
With @mendess's suggestion, I updated my code to use the state to pass the
D1Database
object.But it's still problematic when the
get_user
call the function that invokes the d1.Compilation error:
Note that the
debug_handler
mentioned here is not useful because of #485.Removing the invocation to d1 will make it compile:
Original question
I want to pass the
d1
to a request handler, but failed to do so. I am a very beginner to rust.This is what I initially tried, and got the error
borrowed data escapes outside of function
d1escapes the function body here
.And then I tried to passing it by value:
Now it said:
Is there any other way I can pass the
d1
? And is theClone
a missing feature (method) of the struct?Beta Was this translation helpful? Give feedback.
All reactions