Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add FromStr for Endpoint #558

Merged
merged 1 commit into from
Feb 13, 2021

Commits on Feb 11, 2021

  1. chore: add FromStr for Endpoint

    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]>
    Hoverbear committed Feb 11, 2021
    Configuration menu
    Copy the full SHA
    deab93e View commit details
    Browse the repository at this point in the history