Warp: TLS example doesn't work

Created on 3 May 2019  路  3Comments  路  Source: seanmonstar/warp

I am quite new to rust so I might be doing something fundamentally wrong.

I tried compiling with --features "tls" and get the message:

error[E0599]: no method named `tls` found for type `warp::Server<warp::filter::map::Map<impl warp::Filter+std::marker::Copy, [closure@src/main.rs:11:34: 11:52]>>` in the current scope
  --> src/main.rs:14:10
   |
14 |         .tls("examples/tls/cert.pem", "examples/tls/key.rsa")
   |        

This is with a 0.1.15 version from crates.io.

Most helpful comment

Specifically, adding this to your Cargo.toml:

[dependencies]
warp = { version = "0.1.15", features = ["tls"] }

All 3 comments

It looks like you've copied the example to your own crate (since I see the file is called main). In that case, you don't need to pass --features in the command, but rather specify them for a dependency. See the guide for more: https://doc.rust-lang.org/stable/cargo/reference/specifying-dependencies.html#choosing-features

Specifically, adding this to your Cargo.toml:

[dependencies]
warp = { version = "0.1.15", features = ["tls"] }

Finally got it working! Thank you, Sean!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

richardanaya picture richardanaya  路  6Comments

kamalmarhubi picture kamalmarhubi  路  5Comments

seanmonstar picture seanmonstar  路  8Comments

silvioprog picture silvioprog  路  3Comments

hwchen picture hwchen  路  3Comments