Commit f49d4bd
authored
chore: add FromStr for Endpoint (#558)
This is particularly handy when combined with `clap::value_t`.
Here's demo of it working with Clap:
```bash
cargo +stable init --bin tonic-demo
cd tonic-demo
cat <<-EOF >> Cargo.toml
clap = "*"
tonic = { path = "../hyperium/tonic/tonic" }
EOF
cat <<-EOF > src/main.rs
use clap::{value_t, App, Arg};
use tonic::transport::Endpoint;
fn main() {
let matches = App::new("tonic-demo")
.arg(Arg::with_name("host"))
.get_matches();
let x = value_t!(matches.value_of("host"), Endpoint);
println!("{:?}", x);
}
EOF
cargo +stable run -- https://127.0.0.1:443
```
Signed-off-by: Ana Hobden <[email protected]>1 parent 4f5e160 commit f49d4bd
1 file changed
+9
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
16 | 17 | | |
17 | 18 | | |
18 | 19 | | |
| |||
351 | 352 | | |
352 | 353 | | |
353 | 354 | | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
0 commit comments