polyester/gen/connect/marketoverview.v1.rs
1// @generated by connectrpc-codegen. DO NOT EDIT.
2
3///Shorthand for `OwnedView<ListMarketOverviewRequestView<'static>>`.
4pub type OwnedListMarketOverviewRequestView = ::buffa::view::OwnedView<
5 crate::proto::marketoverview::v1::__buffa::view::ListMarketOverviewRequestView<
6 'static,
7 >,
8>;
9///Shorthand for `OwnedView<ListMarketOverviewResponseView<'static>>`.
10pub type OwnedListMarketOverviewResponseView = ::buffa::view::OwnedView<
11 crate::proto::marketoverview::v1::__buffa::view::ListMarketOverviewResponseView<
12 'static,
13 >,
14>;
15impl ::connectrpc::Encodable<
16 crate::proto::marketoverview::v1::ListMarketOverviewResponse,
17>
18for crate::proto::marketoverview::v1::__buffa::view::ListMarketOverviewResponseView<'_> {
19 fn encode(
20 &self,
21 codec: ::connectrpc::CodecFormat,
22 ) -> ::std::result::Result<::buffa::bytes::Bytes, ::connectrpc::ConnectError> {
23 ::connectrpc::__codegen::encode_view_body(self, codec)
24 }
25}
26impl ::connectrpc::Encodable<
27 crate::proto::marketoverview::v1::ListMarketOverviewResponse,
28>
29for ::buffa::view::OwnedView<
30 crate::proto::marketoverview::v1::__buffa::view::ListMarketOverviewResponseView<
31 'static,
32 >,
33> {
34 fn encode(
35 &self,
36 codec: ::connectrpc::CodecFormat,
37 ) -> ::std::result::Result<::buffa::bytes::Bytes, ::connectrpc::ConnectError> {
38 ::connectrpc::__codegen::encode_view_body(self.reborrow(), codec)
39 }
40}
41/// Full service name for this service.
42pub const MARKET_OVERVIEW_SERVICE_SERVICE_NAME: &str = "marketoverview.v1.MarketOverviewService";
43/// Static [`Spec`](::connectrpc::Spec) for the server-side `ListMarketOverview` RPC.
44///
45/// The dispatcher surfaces this on
46/// [`RequestContext::spec`](::connectrpc::RequestContext::spec).
47pub const MARKET_OVERVIEW_SERVICE_LIST_MARKET_OVERVIEW_SPEC: ::connectrpc::Spec = ::connectrpc::Spec::server(
48 "/marketoverview.v1.MarketOverviewService/ListMarketOverview",
49 ::connectrpc::StreamType::Unary,
50 )
51 .with_idempotency_level(::connectrpc::IdempotencyLevel::Unknown);
52/// List ticker-style market overview rows with optional sparklines.
53/// Supports symbol filtering, sorting, and pagination controls.
54///
55/// # Implementing handlers
56///
57/// Implement methods with plain `async fn`; the returned future satisfies
58/// the `Send` bound automatically.
59///
60/// **Unary and server-streaming requests** arrive as
61/// [`ServiceRequest<'_, Req>`](::connectrpc::ServiceRequest): a zero-copy
62/// view of the request plus its body, valid for the duration of the call.
63/// Fields are read directly (`request.name` is a `&str` into the decoded
64/// buffer) and the borrow may be held across `.await` points. Anything
65/// that must outlive the call — `tokio::spawn`, channels, server state,
66/// or data captured by a returned response stream — takes owned data:
67/// call `request.to_owned_message()` (or copy the specific fields)
68/// first.
69///
70/// **Client-streaming and bidi requests** arrive as
71/// [`InboundStream<Req>`](::connectrpc::InboundStream) — a
72/// `ServiceStream` of [`StreamMessage`](::connectrpc::StreamMessage)s.
73/// Each item owns its decoded buffer and is `Send + 'static`, so items
74/// can be buffered or moved into spawned tasks; read fields zero-copy
75/// through the generated accessor methods (`item.name()`) or `.view()`,
76/// convert with `.to_owned_message()`, or yield an item back unchanged —
77/// `StreamMessage<M>` implements `Encodable<M>`.
78///
79/// Request types resolved through `extern_path` (e.g. well-known types
80/// from another crate) use the same wrappers; the crate that owns the
81/// type must be generated with buffa ≥ 0.8.0 and views enabled so the
82/// backing `HasMessageView` impl exists.
83///
84/// The `impl Encodable<Out>` return bound accepts the owned `Out`, the
85/// generated `OutView<'_>` / `OwnedOutView`,
86/// [`MaybeBorrowed`](::connectrpc::MaybeBorrowed), or
87/// [`PreEncoded`](::connectrpc::PreEncoded) for handlers that encode a
88/// non-`'static` view internally and pass the bytes across the handler
89/// boundary. View bodies are not emitted for output types mapped via
90/// `extern_path` (the impl would be an orphan); return owned for
91/// WKT/extern outputs.
92///
93/// Server-streaming and bidi-streaming methods return
94/// `ServiceStream<impl Encodable<Out> + Send + use<Self>>`. The
95/// `use<Self>` precise-capturing clause excludes `&self`'s lifetime and
96/// the request's lifetime (unary methods use `use<'a, Self>` and may
97/// borrow from `&self`), so stream items must be `'static` and cannot
98/// borrow from the request. To stream view-encoded data, encode each
99/// item inside the stream body and yield
100/// [`PreEncoded`](::connectrpc::PreEncoded) — see its `# Streaming
101/// example` doc.
102#[allow(clippy::type_complexity)]
103pub trait MarketOverviewService: Send + Sync + 'static {
104 /// Handle the ListMarketOverview RPC.
105 ///
106 /// `'a` lets the response body borrow from `&self` (e.g. server-resident state).
107 ///
108 /// `request` is borrowed from the request body and is valid for the
109 /// duration of the call; message fields are read directly on it
110 /// (zero-copy). The response cannot borrow from `request` — use
111 /// `.to_owned_message()` (or copy the specific fields) for anything
112 /// returned, stored, or moved into `tokio::spawn`.
113 fn list_market_overview<'a>(
114 &'a self,
115 ctx: ::connectrpc::RequestContext,
116 request: ::connectrpc::ServiceRequest<
117 '_,
118 crate::proto::marketoverview::v1::ListMarketOverviewRequest,
119 >,
120 ) -> impl ::std::future::Future<
121 Output = ::connectrpc::ServiceResult<
122 impl ::connectrpc::Encodable<
123 crate::proto::marketoverview::v1::ListMarketOverviewResponse,
124 > + Send + use<'a, Self>,
125 >,
126 > + Send;
127}
128/// Extension trait for registering a service implementation with a Router.
129///
130/// This trait is automatically implemented for all types that implement the service trait.
131/// Prefer [`Router::add_service`](::connectrpc::Router::add_service) for
132/// top-down registration; `register` remains available for compatibility
133/// and cases where the service-first call shape is more convenient.
134///
135/// # Example
136///
137/// ```rust,ignore
138/// use std::sync::Arc;
139///
140/// let service = Arc::new(MyServiceImpl);
141/// let router = service.register(Router::new());
142/// ```
143pub trait MarketOverviewServiceExt: MarketOverviewService {
144 /// Register this service implementation with a Router.
145 ///
146 /// Takes ownership of the `Arc<Self>` and returns a new Router with
147 /// this service's methods registered.
148 fn register(
149 self: ::std::sync::Arc<Self>,
150 router: ::connectrpc::Router,
151 ) -> ::connectrpc::Router;
152}
153impl<S: MarketOverviewService> MarketOverviewServiceExt for S {
154 fn register(
155 self: ::std::sync::Arc<Self>,
156 router: ::connectrpc::Router,
157 ) -> ::connectrpc::Router {
158 router
159 .route_view(
160 MARKET_OVERVIEW_SERVICE_SERVICE_NAME,
161 "ListMarketOverview",
162 {
163 let svc = ::std::sync::Arc::clone(&self);
164 ::connectrpc::view_handler_fn(move |
165 ctx,
166 req: ::buffa::view::OwnedView<
167 crate::proto::marketoverview::v1::__buffa::view::ListMarketOverviewRequestView<
168 'static,
169 >,
170 >,
171 format|
172 {
173 let svc = ::std::sync::Arc::clone(&svc);
174 async move {
175 let sreq = ::connectrpc::ServiceRequest::<
176 crate::proto::marketoverview::v1::ListMarketOverviewRequest,
177 >::from_parts(req.reborrow(), req.bytes());
178 svc.list_market_overview(ctx, sreq)
179 .await?
180 .encode::<
181 crate::proto::marketoverview::v1::ListMarketOverviewResponse,
182 >(format)
183 }
184 })
185 },
186 )
187 .with_spec(MARKET_OVERVIEW_SERVICE_LIST_MARKET_OVERVIEW_SPEC)
188 }
189}
190/// Type-inference marker used by [`Router::add_service`](::connectrpc::Router::add_service).
191#[doc(hidden)]
192pub struct MarketOverviewServiceRegisterMarker;
193impl<
194 S: MarketOverviewService,
195> ::connectrpc::ServiceRegister<MarketOverviewServiceRegisterMarker>
196for ::std::sync::Arc<S> {
197 fn register_service(self, router: ::connectrpc::Router) -> ::connectrpc::Router {
198 <S as MarketOverviewServiceExt>::register(self, router)
199 }
200}
201/// Monomorphic dispatcher for `MarketOverviewService`.
202///
203/// Unlike `.register(Router)` which type-erases each method into an `Arc<dyn ErasedHandler>` stored in a `HashMap`, this struct dispatches via a compile-time `match` on method name: no vtable, no hash lookup.
204///
205/// # Example
206///
207/// ```rust,ignore
208/// use connectrpc::ConnectRpcService;
209///
210/// let server = MarketOverviewServiceServer::new(MyImpl);
211/// let service = ConnectRpcService::new(server);
212/// // hand `service` to axum/hyper as a fallback_service
213/// ```
214pub struct MarketOverviewServiceServer<T> {
215 inner: ::std::sync::Arc<T>,
216}
217impl<T: MarketOverviewService> MarketOverviewServiceServer<T> {
218 /// Wrap a service implementation in a monomorphic dispatcher.
219 pub fn new(service: T) -> Self {
220 Self {
221 inner: ::std::sync::Arc::new(service),
222 }
223 }
224 /// Wrap an already-`Arc`'d service implementation.
225 pub fn from_arc(inner: ::std::sync::Arc<T>) -> Self {
226 Self { inner }
227 }
228}
229impl<T> Clone for MarketOverviewServiceServer<T> {
230 fn clone(&self) -> Self {
231 Self {
232 inner: ::std::sync::Arc::clone(&self.inner),
233 }
234 }
235}
236impl<T: MarketOverviewService> ::connectrpc::Dispatcher
237for MarketOverviewServiceServer<T> {
238 #[inline]
239 fn lookup(
240 &self,
241 path: &str,
242 ) -> Option<::connectrpc::dispatcher::codegen::MethodDescriptor> {
243 let method = path.strip_prefix("marketoverview.v1.MarketOverviewService/")?;
244 match method {
245 "ListMarketOverview" => {
246 Some(
247 ::connectrpc::dispatcher::codegen::MethodDescriptor::unary(false)
248 .with_spec(MARKET_OVERVIEW_SERVICE_LIST_MARKET_OVERVIEW_SPEC),
249 )
250 }
251 _ => None,
252 }
253 }
254 fn call_unary(
255 &self,
256 path: &str,
257 ctx: ::connectrpc::RequestContext,
258 request: ::connectrpc::Payload,
259 format: ::connectrpc::CodecFormat,
260 ) -> ::connectrpc::dispatcher::codegen::UnaryResult {
261 let Some(method) = path.strip_prefix("marketoverview.v1.MarketOverviewService/")
262 else {
263 return ::connectrpc::dispatcher::codegen::unimplemented_unary(path);
264 };
265 let _ = (&ctx, &request, &format);
266 match method {
267 "ListMarketOverview" => {
268 let svc = ::std::sync::Arc::clone(&self.inner);
269 Box::pin(async move {
270 let body = ::connectrpc::dispatcher::codegen::request_proto_bytes::<
271 crate::proto::marketoverview::v1::ListMarketOverviewRequest,
272 >(request.encoded()?, format)?;
273 let req: crate::proto::marketoverview::v1::__buffa::view::ListMarketOverviewRequestView<
274 '_,
275 > = ::connectrpc::dispatcher::codegen::decode_borrowed_request_view(
276 &body,
277 )?;
278 let req = ::connectrpc::ServiceRequest::<
279 crate::proto::marketoverview::v1::ListMarketOverviewRequest,
280 >::from_parts(&req, &body);
281 svc.list_market_overview(ctx, req)
282 .await?
283 .encode::<
284 crate::proto::marketoverview::v1::ListMarketOverviewResponse,
285 >(format)
286 })
287 }
288 _ => ::connectrpc::dispatcher::codegen::unimplemented_unary(path),
289 }
290 }
291 fn call_server_streaming(
292 &self,
293 path: &str,
294 ctx: ::connectrpc::RequestContext,
295 request: ::buffa::bytes::Bytes,
296 format: ::connectrpc::CodecFormat,
297 ) -> ::connectrpc::dispatcher::codegen::StreamingResult {
298 let Some(method) = path.strip_prefix("marketoverview.v1.MarketOverviewService/")
299 else {
300 return ::connectrpc::dispatcher::codegen::unimplemented_streaming(path);
301 };
302 let _ = (&ctx, &request, &format);
303 match method {
304 _ => ::connectrpc::dispatcher::codegen::unimplemented_streaming(path),
305 }
306 }
307 fn call_client_streaming(
308 &self,
309 path: &str,
310 ctx: ::connectrpc::RequestContext,
311 requests: ::connectrpc::dispatcher::codegen::RequestStream,
312 format: ::connectrpc::CodecFormat,
313 ) -> ::connectrpc::dispatcher::codegen::UnaryResult {
314 let Some(method) = path.strip_prefix("marketoverview.v1.MarketOverviewService/")
315 else {
316 return ::connectrpc::dispatcher::codegen::unimplemented_unary(path);
317 };
318 let _ = (&ctx, &requests, &format);
319 match method {
320 _ => ::connectrpc::dispatcher::codegen::unimplemented_unary(path),
321 }
322 }
323 fn call_bidi_streaming(
324 &self,
325 path: &str,
326 ctx: ::connectrpc::RequestContext,
327 requests: ::connectrpc::dispatcher::codegen::RequestStream,
328 format: ::connectrpc::CodecFormat,
329 ) -> ::connectrpc::dispatcher::codegen::StreamingResult {
330 let Some(method) = path.strip_prefix("marketoverview.v1.MarketOverviewService/")
331 else {
332 return ::connectrpc::dispatcher::codegen::unimplemented_streaming(path);
333 };
334 let _ = (&ctx, &requests, &format);
335 match method {
336 _ => ::connectrpc::dispatcher::codegen::unimplemented_streaming(path),
337 }
338 }
339}
340/// Client for this service.
341///
342/// Generic over `T: ClientTransport`. For **gRPC** (HTTP/2), use
343/// `Http2Connection` — it has honest `poll_ready` and composes with
344/// `tower::balance` for multi-connection load balancing. For **Connect
345/// over HTTP/1.1** (or unknown protocol), use `HttpClient`.
346///
347/// # Working with the response
348///
349/// Unary calls return [`UnaryResponse<OwnedView<FooView>>`](::connectrpc::client::UnaryResponse).
350/// [`view()`](::connectrpc::client::UnaryResponse::view) borrows the response
351/// message, so field access is zero-copy:
352///
353/// ```rust,ignore
354/// let resp = client.list_market_overview(request).await?;
355/// let name: &str = resp.view().name; // borrow into the response buffer
356/// ```
357///
358/// If you need the owned struct (e.g. to store or pass by value), use
359/// [`into_owned()`](::connectrpc::client::UnaryResponse::into_owned):
360///
361/// ```rust,ignore
362/// let owned = client.list_market_overview(request).await?.into_owned();
363/// ```
364///
365/// [`into_view()`](::connectrpc::client::UnaryResponse::into_view) keeps the
366/// zero-copy decoded body (an `OwnedView`) without copying; field access on it
367/// goes through `.reborrow()`. Streaming responses yield one
368/// [`StreamMessage`](::connectrpc::StreamMessage) per received message from
369/// `.message().await` — read fields zero-copy through the generated accessor
370/// methods (`msg.name()`) or `.view()`, or convert with `.to_owned_message()`.
371#[derive(Clone)]
372pub struct MarketOverviewServiceClient<T> {
373 transport: T,
374 config: ::connectrpc::client::ClientConfig,
375}
376impl<T> MarketOverviewServiceClient<T>
377where
378 T: ::connectrpc::client::ClientTransport,
379 <T::ResponseBody as ::connectrpc::http_body::Body>::Error: ::std::fmt::Display,
380{
381 /// Create a new client with the given transport and configuration.
382 pub fn new(transport: T, config: ::connectrpc::client::ClientConfig) -> Self {
383 Self { transport, config }
384 }
385 /// Get the client configuration.
386 pub fn config(&self) -> &::connectrpc::client::ClientConfig {
387 &self.config
388 }
389 /// Get a mutable reference to the client configuration.
390 pub fn config_mut(&mut self) -> &mut ::connectrpc::client::ClientConfig {
391 &mut self.config
392 }
393 /// Call the ListMarketOverview RPC. Sends a request to /marketoverview.v1.MarketOverviewService/ListMarketOverview.
394 pub async fn list_market_overview(
395 &self,
396 request: crate::proto::marketoverview::v1::ListMarketOverviewRequest,
397 ) -> Result<
398 ::connectrpc::client::UnaryResponse<
399 ::buffa::view::OwnedView<
400 crate::proto::marketoverview::v1::__buffa::view::ListMarketOverviewResponseView<
401 'static,
402 >,
403 >,
404 >,
405 ::connectrpc::ConnectError,
406 > {
407 self.list_market_overview_with_options(
408 request,
409 ::connectrpc::client::CallOptions::default(),
410 )
411 .await
412 }
413 /// Call the ListMarketOverview RPC with explicit per-call options. Options override [`ClientConfig`](::connectrpc::client::ClientConfig) defaults.
414 pub async fn list_market_overview_with_options(
415 &self,
416 request: crate::proto::marketoverview::v1::ListMarketOverviewRequest,
417 options: ::connectrpc::client::CallOptions,
418 ) -> Result<
419 ::connectrpc::client::UnaryResponse<
420 ::buffa::view::OwnedView<
421 crate::proto::marketoverview::v1::__buffa::view::ListMarketOverviewResponseView<
422 'static,
423 >,
424 >,
425 >,
426 ::connectrpc::ConnectError,
427 > {
428 ::connectrpc::client::call_unary(
429 &self.transport,
430 &self.config,
431 MARKET_OVERVIEW_SERVICE_SERVICE_NAME,
432 "ListMarketOverview",
433 request,
434 options,
435 )
436 .await
437 }
438}