pub struct MarketDataServiceClient<T> { /* private fields */ }Expand description
Client for this service.
Generic over T: ClientTransport. For gRPC (HTTP/2), use
Http2Connection — it has honest poll_ready and composes with
tower::balance for multi-connection load balancing. For Connect
over HTTP/1.1 (or unknown protocol), use HttpClient.
§Working with the response
Unary calls return UnaryResponse<OwnedView<FooView>>.
view() borrows the response
message, so field access is zero-copy:
let resp = client.get_trades(request).await?;
let name: &str = resp.view().name; // borrow into the response bufferIf you need the owned struct (e.g. to store or pass by value), use
into_owned():
let owned = client.get_trades(request).await?.into_owned();into_view() keeps the
zero-copy decoded body (an OwnedView) without copying; field access on it
goes through .reborrow(). Streaming responses yield one
StreamMessage per received message from
.message().await — read fields zero-copy through the generated accessor
methods (msg.name()) or .view(), or convert with .to_owned_message().
Implementations§
Source§impl<T> MarketDataServiceClient<T>
impl<T> MarketDataServiceClient<T>
Sourcepub fn new(transport: T, config: ClientConfig) -> Self
pub fn new(transport: T, config: ClientConfig) -> Self
Create a new client with the given transport and configuration.
Sourcepub fn config(&self) -> &ClientConfig
pub fn config(&self) -> &ClientConfig
Get the client configuration.
Sourcepub fn config_mut(&mut self) -> &mut ClientConfig
pub fn config_mut(&mut self) -> &mut ClientConfig
Get a mutable reference to the client configuration.
Sourcepub async fn get_trades(
&self,
request: GetTradesRequest,
) -> Result<UnaryResponse<OwnedView<GetTradesResponseView<'static>>>, ConnectError>
pub async fn get_trades( &self, request: GetTradesRequest, ) -> Result<UnaryResponse<OwnedView<GetTradesResponseView<'static>>>, ConnectError>
Call the GetTrades RPC. Sends a request to /marketdata.v1.MarketDataService/GetTrades.
Sourcepub async fn get_trades_with_options(
&self,
request: GetTradesRequest,
options: CallOptions,
) -> Result<UnaryResponse<OwnedView<GetTradesResponseView<'static>>>, ConnectError>
pub async fn get_trades_with_options( &self, request: GetTradesRequest, options: CallOptions, ) -> Result<UnaryResponse<OwnedView<GetTradesResponseView<'static>>>, ConnectError>
Call the GetTrades RPC with explicit per-call options. Options override ClientConfig defaults.
Sourcepub async fn get_candles(
&self,
request: GetCandlesRequest,
) -> Result<UnaryResponse<OwnedView<GetCandlesResponseView<'static>>>, ConnectError>
pub async fn get_candles( &self, request: GetCandlesRequest, ) -> Result<UnaryResponse<OwnedView<GetCandlesResponseView<'static>>>, ConnectError>
Call the GetCandles RPC. Sends a request to /marketdata.v1.MarketDataService/GetCandles.
Sourcepub async fn get_candles_with_options(
&self,
request: GetCandlesRequest,
options: CallOptions,
) -> Result<UnaryResponse<OwnedView<GetCandlesResponseView<'static>>>, ConnectError>
pub async fn get_candles_with_options( &self, request: GetCandlesRequest, options: CallOptions, ) -> Result<UnaryResponse<OwnedView<GetCandlesResponseView<'static>>>, ConnectError>
Call the GetCandles RPC with explicit per-call options. Options override ClientConfig defaults.
Sourcepub async fn get_candles_columns(
&self,
request: GetCandlesColumnsRequest,
) -> Result<UnaryResponse<OwnedView<GetCandlesColumnsResponseView<'static>>>, ConnectError>
pub async fn get_candles_columns( &self, request: GetCandlesColumnsRequest, ) -> Result<UnaryResponse<OwnedView<GetCandlesColumnsResponseView<'static>>>, ConnectError>
Call the GetCandlesColumns RPC. Sends a request to /marketdata.v1.MarketDataService/GetCandlesColumns.
Sourcepub async fn get_candles_columns_with_options(
&self,
request: GetCandlesColumnsRequest,
options: CallOptions,
) -> Result<UnaryResponse<OwnedView<GetCandlesColumnsResponseView<'static>>>, ConnectError>
pub async fn get_candles_columns_with_options( &self, request: GetCandlesColumnsRequest, options: CallOptions, ) -> Result<UnaryResponse<OwnedView<GetCandlesColumnsResponseView<'static>>>, ConnectError>
Call the GetCandlesColumns RPC with explicit per-call options. Options override ClientConfig defaults.
Sourcepub async fn get_spot_config(
&self,
request: GetSpotConfigRequest,
) -> Result<UnaryResponse<OwnedView<GetSpotConfigResponseView<'static>>>, ConnectError>
pub async fn get_spot_config( &self, request: GetSpotConfigRequest, ) -> Result<UnaryResponse<OwnedView<GetSpotConfigResponseView<'static>>>, ConnectError>
Call the GetSpotConfig RPC. Sends a request to /marketdata.v1.MarketDataService/GetSpotConfig.
Sourcepub async fn get_spot_config_with_options(
&self,
request: GetSpotConfigRequest,
options: CallOptions,
) -> Result<UnaryResponse<OwnedView<GetSpotConfigResponseView<'static>>>, ConnectError>
pub async fn get_spot_config_with_options( &self, request: GetSpotConfigRequest, options: CallOptions, ) -> Result<UnaryResponse<OwnedView<GetSpotConfigResponseView<'static>>>, ConnectError>
Call the GetSpotConfig RPC with explicit per-call options. Options override ClientConfig defaults.
Trait Implementations§
Source§impl<T: Clone> Clone for MarketDataServiceClient<T>
impl<T: Clone> Clone for MarketDataServiceClient<T>
Source§fn clone(&self) -> MarketDataServiceClient<T>
fn clone(&self) -> MarketDataServiceClient<T>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more