http-rs / surf

Fast and friendly HTTP client framework for async Rust
https://docs.rs/surf
Apache License 2.0
1.45k stars 119 forks source link

Client, RB: remove BoxFuture from .send() #247

Closed Fishrock123 closed 3 years ago

Fishrock123 commented 3 years ago

The pinned future stored inside RequestBuilder for .poll() must be 'static for reasons.

This moves the public facing .send() apis to use async functions, which instead return an impl Future on the stack.

(Link to some additional notes in discord: https://discordapp.com/channels/598880689856970762/649056351385026579/761629816763449375)

9:44 AM] Fishrock: @jbr so I have a patch to remove the BoxedFuture from send properly — but I am curious, why did you want this? [9:46 AM] Fishrock: .send() seems like an apt place to go into a pointer, due to stack sizing for futures. (This is nitty gritty opt) I suppose this gives the user more control tho. [9:46 AM] Fishrock: (Ideally every futures stack would fit entirely into like L2/L3 cpu Cache) [9:51 AM] jbr: in general because my assumption is that externally facing apis should be impl Future (async functions), since that's async rust's general convention for everything except async traits