Replies: 1 comment
-
| I have the same question. Note, that it works for static query strings in  For  In neither case, you can return the result stream if you need a dynamic query string. | 
Beta Was this translation helpful? Give feedback.
                  
                    0 replies
                  
                
            
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
        
    
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Here's a concrete example of what I'm trying to do and why I'm trying to understand this:
I eventually got some help in a Rust discord and was told I could use
Box::leak()to effectively turn the lifetime ofqueryinto'staticas I understand it - leak the memory so Rust doesn't try to clean it up at the end of the function.It works, but it doesn't feel right. It feels very hacky. But I think I understand it. Since
queryis owned by the function andbuilddoesn't seem to take ownership of it, I don't know any other way around it.The main question I have is why are the resulting Query and the QueryBuilder tied together in this way in the first place? It feels like the builder should build and if it needs any data to run the query, it should have been, well, built (or cloned) at that point.
Or am I just misunderstanding how this all works and doing it all wrong? Please help me understand.
Beta Was this translation helpful? Give feedback.
All reactions