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

Re-export tonic in cln-grpc #7545

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ErikDeSmedt
Copy link
Contributor

Using cln-grpc in an outside crate is somewhat tricky. We currently do not have a way to describe the type of T in NodeClient<T>

The export allows the user to write the snippet below.

struct App {
  grpc_client: NodeClient<cln_grpc::tonic::transport::Channel>
}

impl App {

  fn create(destination: AsRef<str>) -> Self {
    NodeClient::connect(destination.as_ref())
      .await
      .unwrap("Failed to connect")
  }
}

async fn main() {
  App::create("http://localhost:1234")
}

Using `cln-grpc` in an outside crate is somewhat tricky.
We currently do not have a way to describe the type of the
`NodeClient<T>`

The export allows the user to write the snippet below.

```rust
struct App {
  grpc_client: NodeClient<cln_grpc::tonic::transport::Channel>
}

impl App {

  fn create(destination: AsRef<str>) -> Self {
    NodeClient::connect(destination.as_ref())
      .await
      .unwrap("Failed to connect")
  }
}

async fn main() {
  App::create("http://localhost:1234")
}
```
@ErikDeSmedt ErikDeSmedt requested a review from cdecker as a code owner August 9, 2024 14:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant