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.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.