pub trait EnvelopeStack: Send + Debug {
type Error: Debug + Error;
// Required methods
fn push(
&mut self,
envelope: Box<Envelope>,
) -> impl Future<Output = Result<(), Self::Error>>;
fn peek(
&mut self,
) -> impl Future<Output = Result<Option<DateTime<Utc>>, Self::Error>>;
fn pop(
&mut self,
) -> impl Future<Output = Result<Option<Box<Envelope>>, Self::Error>>;
fn flush(self) -> impl Future<Output = ()>;
}
Expand description
A stack-like data structure that holds [Envelope
]s.
Required Associated Types§
sourcetype Error: Debug + Error
type Error: Debug + Error
The error type that is returned when an error is encountered during reading or writing the
EnvelopeStack
.
Required Methods§
sourcefn push(
&mut self,
envelope: Box<Envelope>,
) -> impl Future<Output = Result<(), Self::Error>>
fn push( &mut self, envelope: Box<Envelope>, ) -> impl Future<Output = Result<(), Self::Error>>
Pushes an [Envelope
] on top of the stack.
sourcefn peek(
&mut self,
) -> impl Future<Output = Result<Option<DateTime<Utc>>, Self::Error>>
fn peek( &mut self, ) -> impl Future<Output = Result<Option<DateTime<Utc>>, Self::Error>>
Peeks the [Envelope
] on top of the stack.
sourcefn pop(
&mut self,
) -> impl Future<Output = Result<Option<Box<Envelope>>, Self::Error>>
fn pop( &mut self, ) -> impl Future<Output = Result<Option<Box<Envelope>>, Self::Error>>
Pops the [Envelope
] on top of the stack.
sourcefn flush(self) -> impl Future<Output = ()>
fn flush(self) -> impl Future<Output = ()>
Persists all envelopes in the EnvelopeStack
s to external storage, if possible,
and consumes the stack provider.
Object Safety§
This trait is not object safe.