pub trait PayloadBuilder: Send + Unpin {
type PayloadType: PayloadTypes;
type Error;
// Required methods
fn send_and_resolve_payload<'life0, 'async_trait>(
&'life0 self,
attr: <Self::PayloadType as PayloadTypes>::PayloadBuilderAttributes,
) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn Future<Output = Result<<Self::PayloadType as PayloadTypes>::BuiltPayload, PayloadBuilderError>> + Send + Sync>>, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn best_payload<'life0, 'async_trait>(
&'life0 self,
id: PayloadId,
) -> Pin<Box<dyn Future<Output = Option<Result<<Self::PayloadType as PayloadTypes>::BuiltPayload, Self::Error>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn send_new_payload(
&self,
attr: <Self::PayloadType as PayloadTypes>::PayloadBuilderAttributes,
) -> Receiver<Result<PayloadId, Self::Error>>;
fn new_payload<'life0, 'async_trait>(
&'life0 self,
attr: <Self::PayloadType as PayloadTypes>::PayloadBuilderAttributes,
) -> Pin<Box<dyn Future<Output = Result<PayloadId, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn subscribe<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<PayloadEvents<Self::PayloadType>, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}
Expand description
A type that can request, subscribe to and resolve payloads.
Required Associated Types§
sourcetype PayloadType: PayloadTypes
type PayloadType: PayloadTypes
The Payload type for the builder.
Required Methods§
sourcefn send_and_resolve_payload<'life0, 'async_trait>(
&'life0 self,
attr: <Self::PayloadType as PayloadTypes>::PayloadBuilderAttributes,
) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn Future<Output = Result<<Self::PayloadType as PayloadTypes>::BuiltPayload, PayloadBuilderError>> + Send + Sync>>, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn send_and_resolve_payload<'life0, 'async_trait>(
&'life0 self,
attr: <Self::PayloadType as PayloadTypes>::PayloadBuilderAttributes,
) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn Future<Output = Result<<Self::PayloadType as PayloadTypes>::BuiltPayload, PayloadBuilderError>> + Send + Sync>>, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Sends a message to the service to start building a new payload for the given payload attributes and returns a future that resolves to the payload.
sourcefn best_payload<'life0, 'async_trait>(
&'life0 self,
id: PayloadId,
) -> Pin<Box<dyn Future<Output = Option<Result<<Self::PayloadType as PayloadTypes>::BuiltPayload, Self::Error>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn best_payload<'life0, 'async_trait>(
&'life0 self,
id: PayloadId,
) -> Pin<Box<dyn Future<Output = Option<Result<<Self::PayloadType as PayloadTypes>::BuiltPayload, Self::Error>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Returns the best payload for the given identifier.
sourcefn send_new_payload(
&self,
attr: <Self::PayloadType as PayloadTypes>::PayloadBuilderAttributes,
) -> Receiver<Result<PayloadId, Self::Error>>
fn send_new_payload( &self, attr: <Self::PayloadType as PayloadTypes>::PayloadBuilderAttributes, ) -> Receiver<Result<PayloadId, Self::Error>>
Sends a message to the service to start building a new payload for the given payload.
This is the same as PayloadBuilder::new_payload
but does not wait for the result
and returns the receiver instead
sourcefn new_payload<'life0, 'async_trait>(
&'life0 self,
attr: <Self::PayloadType as PayloadTypes>::PayloadBuilderAttributes,
) -> Pin<Box<dyn Future<Output = Result<PayloadId, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn new_payload<'life0, 'async_trait>(
&'life0 self,
attr: <Self::PayloadType as PayloadTypes>::PayloadBuilderAttributes,
) -> Pin<Box<dyn Future<Output = Result<PayloadId, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Starts building a new payload for the given payload attributes.
Returns the identifier of the payload.
sourcefn subscribe<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<PayloadEvents<Self::PayloadType>, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn subscribe<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<PayloadEvents<Self::PayloadType>, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Sends a message to the service to subscribe to payload events. Returns a receiver that will receive them.