Comments (5)
Yea, this inconsistency is a little annoying, I agree. The method filters were some of the first ones I wrote, and back then, I hadn't figured out a nice solution to ditching the ()
, so and
ing them caused this nastiness:
warp::get()
.and(warp::path("hello"))
.map(|((), ())| foobar())
It's probably clearer if they just worked the same as all other filters, huh? I knew I'd forget to fix something before releasing 0.1...
from warp.
Ah! That makes sense. I still haven't looked into the "magic" you're doing in here, mostly just playing around to see what the library is like.
The original title of this issue was going to be about the implementation escaping in the return types of those filters as well, but then I realised they were simply "different". That's probably also something worth fixing at the same time.
What's your position on breaking changes? Do you have a rough timeline for a 0.2 that would batch things like this?
from warp.
The implementation "escaping" was actually because since those functions take a Filter
argument, whether that filter was Clone
or Copy
was lost if the the return value is just impl Filter
. By returning concrete types, those qualities still exist thanks to derive(Copy, Clone)
on the combinators. Since the combinators aren't publicly exported, and thus not nameable, I'd like to think that the return type here can change, as long as the returned type still fulfills the same traits.
I'll probably hold off on a breaking change for at least a little bit, so that these papercuts can be grouped up. Fixing these filters could probably be done by putting the new ones in warp::method::v2
or something...
from warp.
Ah I didn't mean impl Filter
, I just meant a per-filter newtype struct that could still have derive(Copy, Clone)
on it. This would mean a boilerplate impl Filter
for each one, but at least you're guaranteed the type names are not changing. The unnameablity is something I didn't consider, 🤔...
from warp.
Newtypes here can't be done easily, since they take advantage of the combinators and closures. I suppose they could stop using those, but may not be worth the hassle.
from warp.
Related Issues (20)
- Feature request: Fallible extractor filter
- Clarify API docs around multipart forms HOT 2
- Feature request: More customization points in tracing HOT 2
- EC Private key support HOT 1
- Make `Option<F>` a filter when F is a filter
- Feature request: `warp::make_service()` or `warp::service_with_addr()`
- CVE-2023-43669/GHSA-9mcr-873m-xcxp: tungstenite <= 0.20.0 DoS vulnerability HOT 1
- [feature request] [low prio] Non-Metal fallback option HOT 2
- SSE gives up on Streams that return Pending HOT 3
- Server::run should return ! (never type)
- Default OS / self signed certificate without create it HOT 1
- websocket disconnect (code: 1006, reason: "") HOT 2
- Add `rust-version` into `Cargo.toml` HOT 1
- Error `connection closed before message completed` after 60s HOT 2
- Websocket connection closes immediately, but not with firefox HOT 4
- Navigation between panes using vim commands HOT 1
- examples/tls/cert.pem has expired
- Upgrade to hyper v1 HOT 4
- key contains no private key while using ecc key HOT 1
- integrate with monoio
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from warp.