[][src]Struct tonic::transport::Endpoint

pub struct Endpoint { /* fields omitted */ }
This is supported on feature="transport" only.

Channel builder.

This struct is used to build and configure HTTP/2 channels.

Methods

impl Endpoint[src]

pub fn from_static(s: &'static str) -> Self[src]

This is supported on feature="transport" only.

Convert an Endpoint from a static string.

Endpoint::from_static("https://example.com");

pub fn from_shared(s: impl Into<Bytes>) -> Result<Self, InvalidUriBytes>[src]

This is supported on feature="transport" only.

Convert an Endpoint from shared bytes.

Endpoint::from_shared("https://example.com".to_string());

Important traits for &'_ mut F
pub fn timeout(&mut self, dur: Duration) -> &mut Self[src]

This is supported on feature="transport" only.

Apply a timeout to each request.

builder.timeout(Duration::from_secs(5));

Important traits for &'_ mut F
pub fn concurrency_limit(&mut self, limit: usize) -> &mut Self[src]

This is supported on feature="transport" only.

Apply a concurrency limit to each request.

builder.concurrency_limit(256);

Important traits for &'_ mut F
pub fn rate_limit(&mut self, limit: u64, duration: Duration) -> &mut Self[src]

This is supported on feature="transport" only.

Apply a rate limit to each request.

builder.rate_limit(32, Duration::from_secs(1));

Important traits for &'_ mut F
pub fn openssl_tls(
    &mut self,
    ca: Certificate,
    domain: impl Into<Option<String>>
) -> &mut Self
[src]

This is supported on feature="transport" and feature="openssl" only.

Enable TLS and apply the CA as the root certificate.

Providing an optional domain to override. If None is passed to this the TLS implementation will use the Uri that was used to create the Endpoint builder.

let ca = std::fs::read_to_string("ca.pem")?;

let ca = Certificate::from_pem(ca);

builder.openssl_tls(ca, "example.com".to_string());

Important traits for &'_ mut F
pub fn rustls_tls(
    &mut self,
    ca: Certificate,
    domain: impl Into<Option<String>>
) -> &mut Self
[src]

This is supported on feature="transport" and feature="rustls" only.

Enable TLS and apply the CA as the root certificate.

Providing an optional domain to override. If None is passed to this the TLS implementation will use the Uri that was used to create the Endpoint builder.

let ca = std::fs::read_to_string("ca.pem")?;

let ca = Certificate::from_pem(ca);

builder.rustls_tls(ca, "example.com".to_string());

Important traits for &'_ mut F
pub fn intercept_headers<F>(&mut self, f: F) -> &mut Self where
    F: Fn(&mut HeaderMap) + Send + Sync + 'static, 
[src]

This is supported on feature="transport" only.

Intercept outbound HTTP Request headers;

pub fn channel(&self) -> Channel[src]

This is supported on feature="transport" only.

Create a channel from this config.

Trait Implementations

impl Clone for Endpoint[src]

impl From<Uri> for Endpoint[src]

impl Debug for Endpoint[src]

impl TryFrom<Bytes> for Endpoint[src]

type Error = InvalidUriBytes

The type returned in the event of a conversion error.

impl TryFrom<String> for Endpoint[src]

type Error = InvalidUriBytes

The type returned in the event of a conversion error.

impl TryFrom<&'static str> for Endpoint[src]

type Error = Never

The type returned in the event of a conversion error.

Auto Trait Implementations

impl Send for Endpoint

impl Unpin for Endpoint

impl Sync for Endpoint

impl !UnwindSafe for Endpoint

impl !RefUnwindSafe for Endpoint

Blanket Implementations

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]