Struct tonic::transport::Endpoint [−][src]
pub struct Endpoint { /* fields omitted */ }
Expand description
Channel builder.
This struct is used to build and configure HTTP/2 channels.
Implementations
Convert an Endpoint
from a static string.
Panics
This function panics if the argument is an invalid URI.
Endpoint::from_static("https://example.com");
Convert an Endpoint
from shared bytes.
Endpoint::from_shared("https://example.com".to_string());
pub fn user_agent<T>(self, user_agent: T) -> Result<Self, Error> where
T: TryInto<HeaderValue>,
pub fn user_agent<T>(self, user_agent: T) -> Result<Self, Error> where
T: TryInto<HeaderValue>,
Set a custom user-agent header.
user_agent
will be prepended to Tonic’s default user-agent string (tonic/x.x.x
).
It must be a value that can be converted into a valid http::HeaderValue
or building
the endpoint will fail.
builder.user_agent("Greeter").expect("Greeter should be a valid header value");
// user-agent: "Greeter tonic/x.x.x"
Apply a timeout to each request.
builder.timeout(Duration::from_secs(5));
Apply a timeout to connecting to the uri.
Defaults to no timeout.
builder.connect_timeout(Duration::from_secs(5));
Set whether TCP keepalive messages are enabled on accepted connections.
If None
is specified, keepalive is disabled, otherwise the duration
specified will be the time to remain idle before sending TCP keepalive
probes.
Default is no keepalive (None
)
Apply a concurrency limit to each request.
builder.concurrency_limit(256);
Apply a rate limit to each request.
builder.rate_limit(32, Duration::from_secs(1));
Sets the SETTINGS_INITIAL_WINDOW_SIZE
option for HTTP2
stream-level flow control.
Default is 65,535
Sets the max connection-level flow control for HTTP2
Default is 65,535
Set the value of TCP_NODELAY
option for accepted connections. Enabled by default.
Set http2 KEEP_ALIVE_INTERVAL. Uses hyper
’s default otherwise.
Set http2 KEEP_ALIVE_TIMEOUT. Uses hyper
’s default otherwise.
Set http2 KEEP_ALIVE_WHILE_IDLE. Uses hyper
’s default otherwise.
Sets whether to use an adaptive flow control. Uses hyper
’s default otherwise.
Create a channel from this config.
The channel returned by this method does not attempt to connect to the endpoint until first use.
Connect with a custom connector.
This allows you to build a Channel that uses a non-HTTP transport.
See the uds
example for an example on how to use this function to build channel that
uses a Unix socket transport.
The connect_timeout
will still be applied.
Connect with a custom connector lazily.
This allows you to build a Channel that uses a non-HTTP transport connec to it lazily.
See the uds
example for an example on how to use this function to build channel that
uses a Unix socket transport.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Endpoint
impl UnwindSafe for Endpoint
Blanket Implementations
Mutably borrows from an owned value. Read more
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more