> ## Documentation Index
> Fetch the complete documentation index at: https://docs.kinetica.com/llms.txt
> Use this file to discover all available pages before exploring further.

# HyperClient

> HyperClient — Kinetica Rust API

[gpudb\_api](https://docs.kinetica.com/content/api/rust/index.md)::<wbr />[hyper\_client](https://docs.kinetica.com/content/api/rust/hyper_client/index.md)
[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/hyper_client.rs#L30-L48)&#x20;

<pre>`pub struct HyperClient { /* private fields */ }`</pre>

High-performance HTTP client using hyper with connection pooling.This client is optimized for:

<ul>
  <li>HTTP/2 multiplexing</li>
  <li>Aggressive connection reuse</li>
  <li>Minimal abstraction overhead</li>
</ul>

## Implementations

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/hyper_client.rs#L472-L1066)
impl [HyperClient](https://docs.kinetica.com/content/api/rust/hyper_client/struct.HyperClient.md)

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/hyper_client.rs#L479-L481)
pub fn [new](#method.new)() -> Self

Creates a new HyperClient with the default [`HttpClientConfig`](https://docs.kinetica.com/content/api/rust/hyper_client/struct.HttpClientConfig).Since the server doesn’t support HTTP/2, we optimize for HTTP/1.1:

<ul>
  <li>Pooled connections, with a long idle timeout to maximize reuse</li>
  <li>TCP\_NODELAY for low latency</li>
  <li>Fast connection establishment</li>
</ul>

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/hyper_client.rs#L490-L492)
pub fn [with\_tls\_options](#method.with_tls_options)(bypass\_ssl\_cert\_check: [bool](https://doc.rust-lang.org/1.98.1/std/primitive.bool.html)) -> Self

Creates a new `HyperClient` with the default [`HttpClientConfig`](https://docs.kinetica.com/content/api/rust/hyper_client/struct.HttpClientConfig), optionally accepting any server certificate.

##### Arguments

<ul>
  <li>`bypass_ssl_cert_check` - Accept any server certificate. See \[`AcceptAnyServerCert`] for what this gives up.</li>
</ul>

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/hyper_client.rs#L499-L530)
pub fn [with\_config](#method.with_config)(config: &[HttpClientConfig](https://docs.kinetica.com/content/api/rust/hyper_client/struct.HttpClientConfig.md)) -> Self

Creates a new `HyperClient` with the given settings.The connector speaks both `http` and `https`, chosen per request from the URL scheme, so a plaintext deployment is unaffected by TLS being available.

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/hyper_client.rs#L647-L654)
pub async fn [post\_binary](#method.post_binary)( \&self, url: &[str](https://doc.rust-lang.org/1.98.1/std/primitive.str.html), body: [Vec](https://doc.rust-lang.org/1.98.1/alloc/vec/struct.Vec.html)\<[u8](https://doc.rust-lang.org/1.98.1/std/primitive.u8.html)>, headers: &[RequestHeaders](https://docs.kinetica.com/content/api/rust/hyper_client/struct.RequestHeaders.md), ) -> [Result](https://doc.rust-lang.org/1.98.1/core/result/enum.Result.html)\<Bytes, [KineticaError](https://docs.kinetica.com/content/api/rust/errors/enum.KineticaError.md)>

Sends a POST request with binary body.This is optimized for Avro binary payloads sent to Kinetica.

##### Arguments

<ul>
  <li>`url` - Full URL to send request to</li>
  <li>`body` - Binary payload (Avro-encoded)</li>
  <li>`headers` - The headers to send besides the content type; see [`RequestHeaders`](https://docs.kinetica.com/content/api/rust/hyper_client/struct.RequestHeaders)</li>
</ul>

##### Returns

Response body as bytes

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/hyper_client.rs#L678-L703)
pub async fn [post\_binary\_with\_compression](#method.post_binary_with_compression)( \&self, url: &[str](https://doc.rust-lang.org/1.98.1/std/primitive.str.html), body: [Vec](https://doc.rust-lang.org/1.98.1/alloc/vec/struct.Vec.html)\<[u8](https://doc.rust-lang.org/1.98.1/std/primitive.u8.html)>, headers: &[RequestHeaders](https://docs.kinetica.com/content/api/rust/hyper_client/struct.RequestHeaders.md), use\_snappy: [bool](https://doc.rust-lang.org/1.98.1/std/primitive.bool.html), ) -> [Result](https://doc.rust-lang.org/1.98.1/core/result/enum.Result.html)\<Bytes, [KineticaError](https://docs.kinetica.com/content/api/rust/errors/enum.KineticaError.md)>

Sends a POST request with binary body, optionally compressed with Snappy.This is optimized for Avro binary payloads sent to Kinetica.

##### Arguments

<ul>
  <li>`url` - Full URL to send request to</li>
  <li>`body` - Binary payload (Avro-encoded)</li>
  <li>`headers` - The headers to send besides the content type; see [`RequestHeaders`](https://docs.kinetica.com/content/api/rust/hyper_client/struct.RequestHeaders)</li>
  <li>`use_snappy` - Whether to compress the body with Snappy</li>
</ul>

##### Returns

Response body as bytes

##### Compression

When `use_snappy` is true:

<ul>
  <li>The body is compressed using Snappy compression</li>
  <li>Content-Type is set to `application/x-snappy`</li>
  <li>This can significantly reduce transfer time for large payloads</li>
</ul>

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/hyper_client.rs#L720-L728)
pub async fn [post\_binary\_raw](#method.post_binary_raw)( \&self, url: &[str](https://doc.rust-lang.org/1.98.1/std/primitive.str.html), body: [Vec](https://doc.rust-lang.org/1.98.1/alloc/vec/struct.Vec.html)\<[u8](https://doc.rust-lang.org/1.98.1/std/primitive.u8.html)>, headers: &[RequestHeaders](https://docs.kinetica.com/content/api/rust/hyper_client/struct.RequestHeaders.md), use\_snappy: [bool](https://doc.rust-lang.org/1.98.1/std/primitive.bool.html), ) -> [Result](https://doc.rust-lang.org/1.98.1/core/result/enum.Result.html)\<[RawResponse](https://docs.kinetica.com/content/api/rust/hyper_client/struct.RawResponse.md), [KineticaError](https://docs.kinetica.com/content/api/rust/errors/enum.KineticaError.md)>

Sends a POST request like [`Self::post_binary_with_compression`](https://docs.kinetica.com/content/api/rust/hyper_client/struct.HyperClient#method.post_binary_with_compression), but returns the response whatever its status, for the caller to interpret.Failures are classified as follows:

<ul>
  <li>Failing to send the request or to receive a response, including a timeout, is a [`KineticaError::Connection`](https://docs.kinetica.com/content/api/rust/errors/enum.KineticaError#variant.Connection), which fails over.</li>
  <li>A TLS failure is a [`KineticaError::Config`](https://docs.kinetica.com/content/api/rust/errors/enum.KineticaError#variant.Config), which does not: another cluster would present the same certificate problem.</li>
  <li>Failing to read the body, including a timeout, is a [`KineticaError::Http`](https://docs.kinetica.com/content/api/rust/errors/enum.KineticaError#variant.Http).</li>
</ul>

Before any of that, a failed send or a 502 or 503 is retried up to [`HttpClientConfig::max_retries`](https://docs.kinetica.com/content/api/rust/hyper_client/struct.HttpClientConfig#structfield.max_retries) times; the last outcome is what is classified.

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/hyper_client.rs#L764-L775)
pub async fn [post\_json\_raw](#method.post_json_raw)( \&self, url: &[str](https://doc.rust-lang.org/1.98.1/std/primitive.str.html), json: [Option](https://doc.rust-lang.org/1.98.1/core/option/enum.Option.html)\<[String](https://doc.rust-lang.org/1.98.1/alloc/string/struct.String.html)>, headers: &[RequestHeaders](https://docs.kinetica.com/content/api/rust/hyper_client/struct.RequestHeaders.md), ) -> [Result](https://doc.rust-lang.org/1.98.1/core/result/enum.Result.html)\<[RawResponse](https://docs.kinetica.com/content/api/rust/hyper_client/struct.RawResponse.md), [KineticaError](https://docs.kinetica.com/content/api/rust/errors/enum.KineticaError.md)>

Sends a POST with a JSON body, or with none, and returns the response whatever its status; failures are classified as [`Self::post_binary_raw`](https://docs.kinetica.com/content/api/rust/hyper_client/struct.HyperClient#method.post_binary_raw) classifies them.

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/hyper_client.rs#L784-L791)
pub async fn [post\_binary\_raw\_fast](#method.post_binary_raw_fast)( \&self, url: &[str](https://doc.rust-lang.org/1.98.1/std/primitive.str.html), body: [Vec](https://doc.rust-lang.org/1.98.1/alloc/vec/struct.Vec.html)\<[u8](https://doc.rust-lang.org/1.98.1/std/primitive.u8.html)>, headers: &[RequestHeaders](https://docs.kinetica.com/content/api/rust/hyper_client/struct.RequestHeaders.md), ) -> [Result](https://doc.rust-lang.org/1.98.1/core/result/enum.Result.html)\<[RawResponse](https://docs.kinetica.com/content/api/rust/hyper_client/struct.RawResponse.md), [KineticaError](https://docs.kinetica.com/content/api/rust/errors/enum.KineticaError.md)>

Sends a POST request like [`Self::post_binary_raw`](https://docs.kinetica.com/content/api/rust/hyper_client/struct.HyperClient#method.post_binary_raw), through the fast client, for a quick status check: its own connection pool and limits, a connect timeout and a response timeout of \[`FAST_CONNECTION_TIMEOUT`] each, and no retries.The two timeouts cannot be told apart here, so the wait for a response is bounded by both together.

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/hyper_client.rs#L973-L976)
pub async fn [get\_text](#method.get_text)(\&self, url: &[str](https://doc.rust-lang.org/1.98.1/std/primitive.str.html)) -> [Result](https://doc.rust-lang.org/1.98.1/core/result/enum.Result.html)\<[String](https://doc.rust-lang.org/1.98.1/alloc/string/struct.String.html), [KineticaError](https://docs.kinetica.com/content/api/rust/errors/enum.KineticaError.md)>

Sends a GET request and returns the response body as text.This is used for simple health checks like pinging the server.

##### Arguments

<ul>
  <li>`url` - Full URL to send request to</li>
</ul>

##### Returns

Response body as a string

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/hyper_client.rs#L981-L983)
pub async fn [get\_text\_with\_timeout](#method.get_text_with_timeout)( \&self, url: &[str](https://doc.rust-lang.org/1.98.1/std/primitive.str.html), limit: [Duration](https://doc.rust-lang.org/1.98.1/core/time/struct.Duration.html), ) -> [Result](https://doc.rust-lang.org/1.98.1/core/result/enum.Result.html)\<[String](https://doc.rust-lang.org/1.98.1/alloc/string/struct.String.html), [KineticaError](https://docs.kinetica.com/content/api/rust/errors/enum.KineticaError.md)>

Like [`Self::get_text`](https://docs.kinetica.com/content/api/rust/hyper_client/struct.HyperClient#method.get_text), for health checks that must answer quickly: `limit` replaces the client’s timeouts, and the request goes through the separate health-check connection limits.

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/hyper_client.rs#L988-L990)
pub async fn [ping](#method.ping)( \&self, url: &[str](https://doc.rust-lang.org/1.98.1/std/primitive.str.html), headers: &[RequestHeaders](https://docs.kinetica.com/content/api/rust/hyper_client/struct.RequestHeaders.md), limit: [Option](https://doc.rust-lang.org/1.98.1/core/option/enum.Option.html)\<[Duration](https://doc.rust-lang.org/1.98.1/core/time/struct.Duration.html)>, ) -> [Result](https://doc.rust-lang.org/1.98.1/core/result/enum.Result.html)\<[String](https://doc.rust-lang.org/1.98.1/alloc/string/struct.String.html), [KineticaError](https://docs.kinetica.com/content/api/rust/errors/enum.KineticaError.md)>

Sends a GET with `headers` and returns the body as text, whatever the status; `limit` bounds the response and the body each, `None` waiting as long as it takes.

## Trait Implementations

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/hyper_client.rs#L29)
impl [Clone](https://doc.rust-lang.org/1.98.1/core/clone/trait.Clone.html) for [HyperClient](https://docs.kinetica.com/content/api/rust/hyper_client/struct.HyperClient.md)

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/hyper_client.rs#L29)
fn [clone](https://doc.rust-lang.org/1.98.1/core/clone/trait.Clone.html#tymethod.clone)(\&self) -> [HyperClient](https://docs.kinetica.com/content/api/rust/hyper_client/struct.HyperClient.md)

Returns a duplicate of the value. [Read more](https://doc.rust-lang.org/1.98.1/core/clone/trait.Clone.html#tymethod.clone)

1.0.0 (const: [unstable](https://github.com/rust-lang/rust/issues/142757)) · [Source](https://doc.rust-lang.org/1.98.1/src/core/clone.rs.html#245-247)
fn [clone\_from](https://doc.rust-lang.org/1.98.1/core/clone/trait.Clone.html#method.clone_from)(\&mut self, source: \&Self)

Performs copy-assignment from `source`. [Read more](https://doc.rust-lang.org/1.98.1/core/clone/trait.Clone.html#method.clone_from)

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/hyper_client.rs#L50-L54)
impl [Default](https://doc.rust-lang.org/1.98.1/core/default/trait.Default.html) for [HyperClient](https://docs.kinetica.com/content/api/rust/hyper_client/struct.HyperClient.md)

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/hyper_client.rs#L51-L53)
fn [default](https://doc.rust-lang.org/1.98.1/core/default/trait.Default.html#tymethod.default)() -> Self

Returns the “default value” for a type. [Read more](https://doc.rust-lang.org/1.98.1/core/default/trait.Default.html#tymethod.default)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.