pub struct BrokerGrpcAdapterServer { /* private fields */ }Implementations§
Source§impl BrokerGrpcAdapterServer
impl BrokerGrpcAdapterServer
Sourcepub async fn connect(upstream_url: impl Into<String>) -> Result<Self, Error>
pub async fn connect(upstream_url: impl Into<String>) -> Result<Self, Error>
Examples found in repository?
examples/grpc_server.rs (line 12)
7async fn main() -> Result<(), Box<dyn std::error::Error>> {
8 let upstream = std::env::var("BROKER_OPENAPI_GRPC_URL")?;
9 let listen_addr = std::env::var("OPENAPI_PROXY_LISTEN_ADDR")
10 .unwrap_or_else(|_| "0.0.0.0:50051".to_string());
11
12 let grpc = BrokerGrpcAdapterServer::connect(upstream.clone()).await?;
13 let addr: SocketAddr = listen_addr.parse()?;
14
15 println!("broker adapter listening on {addr}");
16 println!("forwarding to broker gRPC upstream: {upstream}");
17 Server::builder()
18 .add_service(grpc.into_tonic_service())
19 .serve(addr)
20 .await?;
21
22 Ok(())
23}Sourcepub fn into_tonic_service(self) -> OpenApiServiceServer<Self>
pub fn into_tonic_service(self) -> OpenApiServiceServer<Self>
Examples found in repository?
examples/grpc_server.rs (line 18)
7async fn main() -> Result<(), Box<dyn std::error::Error>> {
8 let upstream = std::env::var("BROKER_OPENAPI_GRPC_URL")?;
9 let listen_addr = std::env::var("OPENAPI_PROXY_LISTEN_ADDR")
10 .unwrap_or_else(|_| "0.0.0.0:50051".to_string());
11
12 let grpc = BrokerGrpcAdapterServer::connect(upstream.clone()).await?;
13 let addr: SocketAddr = listen_addr.parse()?;
14
15 println!("broker adapter listening on {addr}");
16 println!("forwarding to broker gRPC upstream: {upstream}");
17 Server::builder()
18 .add_service(grpc.into_tonic_service())
19 .serve(addr)
20 .await?;
21
22 Ok(())
23}Trait Implementations§
Source§impl Clone for BrokerGrpcAdapterServer
impl Clone for BrokerGrpcAdapterServer
Source§fn clone(&self) -> BrokerGrpcAdapterServer
fn clone(&self) -> BrokerGrpcAdapterServer
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for BrokerGrpcAdapterServer
impl Debug for BrokerGrpcAdapterServer
Source§impl OpenApiService for BrokerGrpcAdapterServer
impl OpenApiService for BrokerGrpcAdapterServer
Source§type StreamCandlesStream = Pin<Box<dyn Stream<Item = Result<StreamCandlesResponse, Status>> + Send>>
type StreamCandlesStream = Pin<Box<dyn Stream<Item = Result<StreamCandlesResponse, Status>> + Send>>
Server streaming response type for the StreamCandles method.
fn register_user<'life0, 'async_trait>(
&'life0 self,
request: Request<RegisterUserRequest>,
) -> Pin<Box<dyn Future<Output = Result<Response<RegisterUserResponse>, Status>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn login<'life0, 'async_trait>(
&'life0 self,
request: Request<LoginRequest>,
) -> Pin<Box<dyn Future<Output = Result<Response<LoginResponse>, Status>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn logout<'life0, 'async_trait>(
&'life0 self,
request: Request<LogoutRequest>,
) -> Pin<Box<dyn Future<Output = Result<Response<LogoutResponse>, Status>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn fetch_balance<'life0, 'async_trait>(
&'life0 self,
request: Request<FetchBalanceRequest>,
) -> Pin<Box<dyn Future<Output = Result<Response<FetchBalanceResponse>, Status>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn fetch_open_positions<'life0, 'async_trait>(
&'life0 self,
request: Request<FetchOpenPositionsRequest>,
) -> Pin<Box<dyn Future<Output = Result<Response<FetchOpenPositionsResponse>, Status>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn place_market_order<'life0, 'async_trait>(
&'life0 self,
request: Request<PlaceMarketOrderRequest>,
) -> Pin<Box<dyn Future<Output = Result<Response<PlaceMarketOrderResponse>, Status>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn quote_volume<'life0, 'async_trait>(
&'life0 self,
request: Request<QuoteVolumeRequest>,
) -> Pin<Box<dyn Future<Output = Result<Response<QuoteVolumeResponse>, Status>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_candles<'life0, 'async_trait>(
&'life0 self,
request: Request<GetCandlesRequest>,
) -> Pin<Box<dyn Future<Output = Result<Response<GetCandlesResponse>, Status>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn stream_candles<'life0, 'async_trait>(
&'life0 self,
request: Request<StreamCandlesRequest>,
) -> Pin<Box<dyn Future<Output = Result<Response<Self::StreamCandlesStream>, Status>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_server_time<'life0, 'async_trait>(
&'life0 self,
request: Request<GetServerTimeRequest>,
) -> Pin<Box<dyn Future<Output = Result<Response<GetServerTimeResponse>, Status>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Auto Trait Implementations§
impl Freeze for BrokerGrpcAdapterServer
impl !RefUnwindSafe for BrokerGrpcAdapterServer
impl Send for BrokerGrpcAdapterServer
impl Sync for BrokerGrpcAdapterServer
impl Unpin for BrokerGrpcAdapterServer
impl UnsafeUnpin for BrokerGrpcAdapterServer
impl !UnwindSafe for BrokerGrpcAdapterServer
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request