Trait PayloadBuilder
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 'life0: 'async_trait,
Self: '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 'life0: 'async_trait,
Self: '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 'life0: 'async_trait,
Self: 'async_trait;
fn subscribe<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<PayloadEvents<Self::PayloadType>, Self::Error>> + Send + 'async_trait>>
where 'life0: 'async_trait,
Self: 'async_trait;
}
Expand description
A type that can request, subscribe to and resolve payloads.
Required Associated Types§
type PayloadType: PayloadTypes
type PayloadType: PayloadTypes
The Payload type for the builder.
type Error
type Error
The error type returned by the builder.
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
'life0: 'async_trait,
Self: '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
'life0: 'async_trait,
Self: '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.
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
'life0: 'async_trait,
Self: '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
'life0: 'async_trait,
Self: 'async_trait,
Returns the best payload for the given identifier.
fn 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
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
'life0: 'async_trait,
Self: '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
'life0: 'async_trait,
Self: 'async_trait,
Starts building a new payload for the given payload attributes.
Returns the identifier of the payload.
fn subscribe<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<PayloadEvents<Self::PayloadType>, Self::Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn subscribe<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<PayloadEvents<Self::PayloadType>, Self::Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
Sends a message to the service to subscribe to payload events. Returns a receiver that will receive them.