pub trait PolychartService:
Send
+ Sync
+ 'static {
Show 15 methods
// Required methods
fn get_market_layers<'a>(
&'a self,
ctx: RequestContext,
request: ServiceRequest<'_, GetMarketLayersRequest>,
) -> impl Future<Output = ServiceResult<impl Encodable<GetMarketLayersResponse> + Send + use<'a, Self>>> + Send;
fn list_inbox_market_layers<'a>(
&'a self,
ctx: RequestContext,
request: ServiceRequest<'_, ListInboxMarketLayersRequest>,
) -> impl Future<Output = ServiceResult<impl Encodable<ListInboxMarketLayersResponse> + Send + use<'a, Self>>> + Send;
fn get_layer_snapshot<'a>(
&'a self,
ctx: RequestContext,
request: ServiceRequest<'_, GetLayerSnapshotRequest>,
) -> impl Future<Output = ServiceResult<impl Encodable<GetLayerSnapshotResponse> + Send + use<'a, Self>>> + Send;
fn get_layer_subscribe_tokens<'a>(
&'a self,
ctx: RequestContext,
request: ServiceRequest<'_, GetLayerSubscribeTokensRequest>,
) -> impl Future<Output = ServiceResult<impl Encodable<GetLayerSubscribeTokensResponse> + Send + use<'a, Self>>> + Send;
fn resolve_layer_share_token<'a>(
&'a self,
ctx: RequestContext,
request: ServiceRequest<'_, ResolveLayerShareTokenRequest>,
) -> impl Future<Output = ServiceResult<impl Encodable<ResolveLayerShareTokenResponse> + Send + use<'a, Self>>> + Send;
fn create_layer_share_link<'a>(
&'a self,
ctx: RequestContext,
request: ServiceRequest<'_, CreateLayerShareLinkRequest>,
) -> impl Future<Output = ServiceResult<impl Encodable<CreateLayerShareLinkResponse> + Send + use<'a, Self>>> + Send;
fn revoke_layer_share_link<'a>(
&'a self,
ctx: RequestContext,
request: ServiceRequest<'_, RevokeLayerShareLinkRequest>,
) -> impl Future<Output = ServiceResult<impl Encodable<RevokeLayerShareLinkResponse> + Send + use<'a, Self>>> + Send;
fn list_owner_published_layers<'a>(
&'a self,
ctx: RequestContext,
request: ServiceRequest<'_, ListOwnerPublishedLayersRequest>,
) -> impl Future<Output = ServiceResult<impl Encodable<ListOwnerPublishedLayersResponse> + Send + use<'a, Self>>> + Send;
fn publish_layer<'a>(
&'a self,
ctx: RequestContext,
request: ServiceRequest<'_, PublishLayerRequest>,
) -> impl Future<Output = ServiceResult<impl Encodable<PublishLayerResponse> + Send + use<'a, Self>>> + Send;
fn unpublish_layer<'a>(
&'a self,
ctx: RequestContext,
request: ServiceRequest<'_, UnpublishLayerRequest>,
) -> impl Future<Output = ServiceResult<impl Encodable<UnpublishLayerResponse> + Send + use<'a, Self>>> + Send;
fn upsert_layer<'a>(
&'a self,
ctx: RequestContext,
request: ServiceRequest<'_, UpsertLayerRequest>,
) -> impl Future<Output = ServiceResult<impl Encodable<UpsertLayerResponse> + Send + use<'a, Self>>> + Send;
fn delete_layer<'a>(
&'a self,
ctx: RequestContext,
request: ServiceRequest<'_, DeleteLayerRequest>,
) -> impl Future<Output = ServiceResult<impl Encodable<DeleteLayerResponse> + Send + use<'a, Self>>> + Send;
fn upsert_drawing<'a>(
&'a self,
ctx: RequestContext,
request: ServiceRequest<'_, UpsertDrawingRequest>,
) -> impl Future<Output = ServiceResult<impl Encodable<UpsertDrawingResponse> + Send + use<'a, Self>>> + Send;
fn delete_drawing<'a>(
&'a self,
ctx: RequestContext,
request: ServiceRequest<'_, DeleteDrawingRequest>,
) -> impl Future<Output = ServiceResult<impl Encodable<DeleteDrawingResponse> + Send + use<'a, Self>>> + Send;
fn set_layer_subscriptions<'a>(
&'a self,
ctx: RequestContext,
request: ServiceRequest<'_, SetLayerSubscriptionsRequest>,
) -> impl Future<Output = ServiceResult<impl Encodable<SetLayerSubscriptionsResponse> + Send + use<'a, Self>>> + Send;
}Expand description
PolychartService persists chart drawing layers and manages sharing.
§Implementing handlers
Implement methods with plain async fn; the returned future satisfies
the Send bound automatically.
Unary and server-streaming requests arrive as
ServiceRequest<'_, Req>: a zero-copy
view of the request plus its body, valid for the duration of the call.
Fields are read directly (request.name is a &str into the decoded
buffer) and the borrow may be held across .await points. Anything
that must outlive the call — tokio::spawn, channels, server state,
or data captured by a returned response stream — takes owned data:
call request.to_owned_message() (or copy the specific fields)
first.
Client-streaming and bidi requests arrive as
InboundStream<Req> — a
ServiceStream of StreamMessages.
Each item owns its decoded buffer and is Send + 'static, so items
can be buffered or moved into spawned tasks; read fields zero-copy
through the generated accessor methods (item.name()) or .view(),
convert with .to_owned_message(), or yield an item back unchanged —
StreamMessage<M> implements Encodable<M>.
Request types resolved through extern_path (e.g. well-known types
from another crate) use the same wrappers; the crate that owns the
type must be generated with buffa ≥ 0.8.0 and views enabled so the
backing HasMessageView impl exists.
The impl Encodable<Out> return bound accepts the owned Out, the
generated OutView<'_> / OwnedOutView,
MaybeBorrowed, or
PreEncoded for handlers that encode a
non-'static view internally and pass the bytes across the handler
boundary. View bodies are not emitted for output types mapped via
extern_path (the impl would be an orphan); return owned for
WKT/extern outputs.
Server-streaming and bidi-streaming methods return
ServiceStream<impl Encodable<Out> + Send + use<Self>>. The
use<Self> precise-capturing clause excludes &self’s lifetime and
the request’s lifetime (unary methods use use<'a, Self> and may
borrow from &self), so stream items must be 'static and cannot
borrow from the request. To stream view-encoded data, encode each
item inside the stream body and yield
PreEncoded — see its # Streaming example doc.
Required Methods§
Sourcefn get_market_layers<'a>(
&'a self,
ctx: RequestContext,
request: ServiceRequest<'_, GetMarketLayersRequest>,
) -> impl Future<Output = ServiceResult<impl Encodable<GetMarketLayersResponse> + Send + use<'a, Self>>> + Send
fn get_market_layers<'a>( &'a self, ctx: RequestContext, request: ServiceRequest<'_, GetMarketLayersRequest>, ) -> impl Future<Output = ServiceResult<impl Encodable<GetMarketLayersResponse> + Send + use<'a, Self>>> + Send
GetMarketLayers returns the caller’s subscribed layers and drawings for a market.
'a lets the response body borrow from &self (e.g. server-resident state).
request is borrowed from the request body and is valid for the
duration of the call; message fields are read directly on it
(zero-copy). The response cannot borrow from request — use
.to_owned_message() (or copy the specific fields) for anything
returned, stored, or moved into tokio::spawn.
Sourcefn list_inbox_market_layers<'a>(
&'a self,
ctx: RequestContext,
request: ServiceRequest<'_, ListInboxMarketLayersRequest>,
) -> impl Future<Output = ServiceResult<impl Encodable<ListInboxMarketLayersResponse> + Send + use<'a, Self>>> + Send
fn list_inbox_market_layers<'a>( &'a self, ctx: RequestContext, request: ServiceRequest<'_, ListInboxMarketLayersRequest>, ) -> impl Future<Output = ServiceResult<impl Encodable<ListInboxMarketLayersResponse> + Send + use<'a, Self>>> + Send
ListInboxMarketLayers lists layers explicitly shared to the viewer (metadata only).
'a lets the response body borrow from &self (e.g. server-resident state).
request is borrowed from the request body and is valid for the
duration of the call; message fields are read directly on it
(zero-copy). The response cannot borrow from request — use
.to_owned_message() (or copy the specific fields) for anything
returned, stored, or moved into tokio::spawn.
Sourcefn get_layer_snapshot<'a>(
&'a self,
ctx: RequestContext,
request: ServiceRequest<'_, GetLayerSnapshotRequest>,
) -> impl Future<Output = ServiceResult<impl Encodable<GetLayerSnapshotResponse> + Send + use<'a, Self>>> + Send
fn get_layer_snapshot<'a>( &'a self, ctx: RequestContext, request: ServiceRequest<'_, GetLayerSnapshotRequest>, ) -> impl Future<Output = ServiceResult<impl Encodable<GetLayerSnapshotResponse> + Send + use<'a, Self>>> + Send
GetLayerSnapshot returns a layer and all drawings in it.
'a lets the response body borrow from &self (e.g. server-resident state).
request is borrowed from the request body and is valid for the
duration of the call; message fields are read directly on it
(zero-copy). The response cannot borrow from request — use
.to_owned_message() (or copy the specific fields) for anything
returned, stored, or moved into tokio::spawn.
Sourcefn get_layer_subscribe_tokens<'a>(
&'a self,
ctx: RequestContext,
request: ServiceRequest<'_, GetLayerSubscribeTokensRequest>,
) -> impl Future<Output = ServiceResult<impl Encodable<GetLayerSubscribeTokensResponse> + Send + use<'a, Self>>> + Send
fn get_layer_subscribe_tokens<'a>( &'a self, ctx: RequestContext, request: ServiceRequest<'_, GetLayerSubscribeTokensRequest>, ) -> impl Future<Output = ServiceResult<impl Encodable<GetLayerSubscribeTokensResponse> + Send + use<'a, Self>>> + Send
GetLayerSubscribeTokens returns realtime subscribe tokens for layer channels (batch).
'a lets the response body borrow from &self (e.g. server-resident state).
request is borrowed from the request body and is valid for the
duration of the call; message fields are read directly on it
(zero-copy). The response cannot borrow from request — use
.to_owned_message() (or copy the specific fields) for anything
returned, stored, or moved into tokio::spawn.
ResolveLayerShareToken resolves an unauthenticated share token to a layer snapshot.
'a lets the response body borrow from &self (e.g. server-resident state).
request is borrowed from the request body and is valid for the
duration of the call; message fields are read directly on it
(zero-copy). The response cannot borrow from request — use
.to_owned_message() (or copy the specific fields) for anything
returned, stored, or moved into tokio::spawn.
CreateLayerShareLink mints a share token for a layer (owner-only).
'a lets the response body borrow from &self (e.g. server-resident state).
request is borrowed from the request body and is valid for the
duration of the call; message fields are read directly on it
(zero-copy). The response cannot borrow from request — use
.to_owned_message() (or copy the specific fields) for anything
returned, stored, or moved into tokio::spawn.
RevokeLayerShareLink revokes a previously minted share token (owner-only).
'a lets the response body borrow from &self (e.g. server-resident state).
request is borrowed from the request body and is valid for the
duration of the call; message fields are read directly on it
(zero-copy). The response cannot borrow from request — use
.to_owned_message() (or copy the specific fields) for anything
returned, stored, or moved into tokio::spawn.
Sourcefn list_owner_published_layers<'a>(
&'a self,
ctx: RequestContext,
request: ServiceRequest<'_, ListOwnerPublishedLayersRequest>,
) -> impl Future<Output = ServiceResult<impl Encodable<ListOwnerPublishedLayersResponse> + Send + use<'a, Self>>> + Send
fn list_owner_published_layers<'a>( &'a self, ctx: RequestContext, request: ServiceRequest<'_, ListOwnerPublishedLayersRequest>, ) -> impl Future<Output = ServiceResult<impl Encodable<ListOwnerPublishedLayersResponse> + Send + use<'a, Self>>> + Send
ListOwnerPublishedLayers lists listed/published layers for an owner (profile/gallery surfaces).
'a lets the response body borrow from &self (e.g. server-resident state).
request is borrowed from the request body and is valid for the
duration of the call; message fields are read directly on it
(zero-copy). The response cannot borrow from request — use
.to_owned_message() (or copy the specific fields) for anything
returned, stored, or moved into tokio::spawn.
Sourcefn publish_layer<'a>(
&'a self,
ctx: RequestContext,
request: ServiceRequest<'_, PublishLayerRequest>,
) -> impl Future<Output = ServiceResult<impl Encodable<PublishLayerResponse> + Send + use<'a, Self>>> + Send
fn publish_layer<'a>( &'a self, ctx: RequestContext, request: ServiceRequest<'_, PublishLayerRequest>, ) -> impl Future<Output = ServiceResult<impl Encodable<PublishLayerResponse> + Send + use<'a, Self>>> + Send
PublishLayer publishes a layer for discovery (owner-only).
'a lets the response body borrow from &self (e.g. server-resident state).
request is borrowed from the request body and is valid for the
duration of the call; message fields are read directly on it
(zero-copy). The response cannot borrow from request — use
.to_owned_message() (or copy the specific fields) for anything
returned, stored, or moved into tokio::spawn.
Sourcefn unpublish_layer<'a>(
&'a self,
ctx: RequestContext,
request: ServiceRequest<'_, UnpublishLayerRequest>,
) -> impl Future<Output = ServiceResult<impl Encodable<UnpublishLayerResponse> + Send + use<'a, Self>>> + Send
fn unpublish_layer<'a>( &'a self, ctx: RequestContext, request: ServiceRequest<'_, UnpublishLayerRequest>, ) -> impl Future<Output = ServiceResult<impl Encodable<UnpublishLayerResponse> + Send + use<'a, Self>>> + Send
UnpublishLayer removes a layer from discovery (owner-only).
'a lets the response body borrow from &self (e.g. server-resident state).
request is borrowed from the request body and is valid for the
duration of the call; message fields are read directly on it
(zero-copy). The response cannot borrow from request — use
.to_owned_message() (or copy the specific fields) for anything
returned, stored, or moved into tokio::spawn.
Sourcefn upsert_layer<'a>(
&'a self,
ctx: RequestContext,
request: ServiceRequest<'_, UpsertLayerRequest>,
) -> impl Future<Output = ServiceResult<impl Encodable<UpsertLayerResponse> + Send + use<'a, Self>>> + Send
fn upsert_layer<'a>( &'a self, ctx: RequestContext, request: ServiceRequest<'_, UpsertLayerRequest>, ) -> impl Future<Output = ServiceResult<impl Encodable<UpsertLayerResponse> + Send + use<'a, Self>>> + Send
UpsertLayer creates or updates a layer (owner-only).
'a lets the response body borrow from &self (e.g. server-resident state).
request is borrowed from the request body and is valid for the
duration of the call; message fields are read directly on it
(zero-copy). The response cannot borrow from request — use
.to_owned_message() (or copy the specific fields) for anything
returned, stored, or moved into tokio::spawn.
Sourcefn delete_layer<'a>(
&'a self,
ctx: RequestContext,
request: ServiceRequest<'_, DeleteLayerRequest>,
) -> impl Future<Output = ServiceResult<impl Encodable<DeleteLayerResponse> + Send + use<'a, Self>>> + Send
fn delete_layer<'a>( &'a self, ctx: RequestContext, request: ServiceRequest<'_, DeleteLayerRequest>, ) -> impl Future<Output = ServiceResult<impl Encodable<DeleteLayerResponse> + Send + use<'a, Self>>> + Send
DeleteLayer deletes a layer and all drawings in it (owner-only).
'a lets the response body borrow from &self (e.g. server-resident state).
request is borrowed from the request body and is valid for the
duration of the call; message fields are read directly on it
(zero-copy). The response cannot borrow from request — use
.to_owned_message() (or copy the specific fields) for anything
returned, stored, or moved into tokio::spawn.
Sourcefn upsert_drawing<'a>(
&'a self,
ctx: RequestContext,
request: ServiceRequest<'_, UpsertDrawingRequest>,
) -> impl Future<Output = ServiceResult<impl Encodable<UpsertDrawingResponse> + Send + use<'a, Self>>> + Send
fn upsert_drawing<'a>( &'a self, ctx: RequestContext, request: ServiceRequest<'_, UpsertDrawingRequest>, ) -> impl Future<Output = ServiceResult<impl Encodable<UpsertDrawingResponse> + Send + use<'a, Self>>> + Send
UpsertDrawing creates or updates a drawing (owner-only).
'a lets the response body borrow from &self (e.g. server-resident state).
request is borrowed from the request body and is valid for the
duration of the call; message fields are read directly on it
(zero-copy). The response cannot borrow from request — use
.to_owned_message() (or copy the specific fields) for anything
returned, stored, or moved into tokio::spawn.
Sourcefn delete_drawing<'a>(
&'a self,
ctx: RequestContext,
request: ServiceRequest<'_, DeleteDrawingRequest>,
) -> impl Future<Output = ServiceResult<impl Encodable<DeleteDrawingResponse> + Send + use<'a, Self>>> + Send
fn delete_drawing<'a>( &'a self, ctx: RequestContext, request: ServiceRequest<'_, DeleteDrawingRequest>, ) -> impl Future<Output = ServiceResult<impl Encodable<DeleteDrawingResponse> + Send + use<'a, Self>>> + Send
DeleteDrawing deletes a drawing (owner-only).
'a lets the response body borrow from &self (e.g. server-resident state).
request is borrowed from the request body and is valid for the
duration of the call; message fields are read directly on it
(zero-copy). The response cannot borrow from request — use
.to_owned_message() (or copy the specific fields) for anything
returned, stored, or moved into tokio::spawn.
Sourcefn set_layer_subscriptions<'a>(
&'a self,
ctx: RequestContext,
request: ServiceRequest<'_, SetLayerSubscriptionsRequest>,
) -> impl Future<Output = ServiceResult<impl Encodable<SetLayerSubscriptionsResponse> + Send + use<'a, Self>>> + Send
fn set_layer_subscriptions<'a>( &'a self, ctx: RequestContext, request: ServiceRequest<'_, SetLayerSubscriptionsRequest>, ) -> impl Future<Output = ServiceResult<impl Encodable<SetLayerSubscriptionsResponse> + Send + use<'a, Self>>> + Send
SetLayerSubscriptions replaces the viewer’s subscriptions for a market.
'a lets the response body borrow from &self (e.g. server-resident state).
request is borrowed from the request body and is valid for the
duration of the call; message fields are read directly on it
(zero-copy). The response cannot borrow from request — use
.to_owned_message() (or copy the specific fields) for anything
returned, stored, or moved into tokio::spawn.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".