Skip to main content

topcoat_runtime/
shard.rs

1use serde::Deserialize;
2
3use crate::{Arguments, SignalValues};
4
5/// The body of a request re-rendering a shard: the current values of its
6/// arguments and of the signals its content created.
7///
8/// The identity of the shard invocation travels separately, in the
9/// request's identity header.
10#[derive(Debug, Deserialize)]
11#[serde(bound(deserialize = "Arguments<A>: Deserialize<'de>"))]
12pub struct ShardRequest<A> {
13    args: Arguments<A>,
14    #[serde(default)]
15    signals: SignalValues,
16}
17
18impl<A> ShardRequest<A> {
19    /// Splits the request into the arguments to hand the shard body and the
20    /// signal values to register on its request context.
21    pub fn into_parts(self) -> (A, SignalValues) {
22        (self.args.0, self.signals)
23    }
24}