pub trait PayloadBuilder:
Debug
+ Send
+ Sync
+ Unpin {
type PayloadType: PayloadTypes;
type Error: Into<PayloadBuilderError>;
// Required methods
fn send_new_payload(
&self,
attr: <Self::PayloadType as PayloadTypes>::PayloadBuilderAttributes,
) -> Receiver<Result<PayloadId, Self::Error>>;
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 resolve_kind<'life0, 'async_trait>(
&'life0 self,
id: PayloadId,
kind: PayloadKind,
) -> 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 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 payload_attributes<'life0, 'async_trait>(
&'life0 self,
id: PayloadId,
) -> Pin<Box<dyn Future<Output = Option<Result<<Self::PayloadType as PayloadTypes>::PayloadBuilderAttributes, Self::Error>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
// Provided method
fn resolve<'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 { ... }
}
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.
Sourcetype Error: Into<PayloadBuilderError>
type Error: Into<PayloadBuilderError>
The error type returned by the builder.
Required Methods§
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.
Returns a receiver that will receive the payload id.
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 resolve_kind<'life0, 'async_trait>(
&'life0 self,
id: PayloadId,
kind: PayloadKind,
) -> 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 resolve_kind<'life0, 'async_trait>(
&'life0 self,
id: PayloadId,
kind: PayloadKind,
) -> Pin<Box<dyn Future<Output = Option<Result<<Self::PayloadType as PayloadTypes>::BuiltPayload, Self::Error>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Resolves the payload job and returns the best payload that has been built so far.
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.
Sourcefn payload_attributes<'life0, 'async_trait>(
&'life0 self,
id: PayloadId,
) -> Pin<Box<dyn Future<Output = Option<Result<<Self::PayloadType as PayloadTypes>::PayloadBuilderAttributes, Self::Error>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn payload_attributes<'life0, 'async_trait>(
&'life0 self,
id: PayloadId,
) -> Pin<Box<dyn Future<Output = Option<Result<<Self::PayloadType as PayloadTypes>::PayloadBuilderAttributes, Self::Error>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Returns the payload attributes associated with the given identifier.
Provided Methods§
Sourcefn resolve<'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 resolve<'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,
Resolves the payload job as fast and possible and returns the best payload that has been built so far.