Struct sentry_core::Envelope
source · [−]pub struct Envelope { /* private fields */ }
Expand description
A Sentry Envelope.
An Envelope is the data format that Sentry uses for Ingestion. It can contain multiple Items, some of which are related, such as Events, and Event Attachments. Other Items, such as Sessions are independent.
See the documentation on Envelopes for more details.
Implementations
sourceimpl Envelope
impl Envelope
sourcepub fn add_item<I>(&mut self, item: I) where
I: Into<EnvelopeItem>,
pub fn add_item<I>(&mut self, item: I) where
I: Into<EnvelopeItem>,
Add a new Envelope Item.
sourcepub fn items(&self) -> EnvelopeItemIter<'_>ⓘNotable traits for EnvelopeItemIter<'s>impl<'s> Iterator for EnvelopeItemIter<'s> type Item = &'s EnvelopeItem;
pub fn items(&self) -> EnvelopeItemIter<'_>ⓘNotable traits for EnvelopeItemIter<'s>impl<'s> Iterator for EnvelopeItemIter<'s> type Item = &'s EnvelopeItem;
Create an Iterator
over all the EnvelopeItem
s.
sourcepub fn event(&self) -> Option<&Event<'static>>
pub fn event(&self) -> Option<&Event<'static>>
Returns the Event
contained in this Envelope, if any.
sourcepub fn filter<P>(self, predicate: P) -> Option<Envelope> where
P: FnMut(&EnvelopeItem) -> bool,
pub fn filter<P>(self, predicate: P) -> Option<Envelope> where
P: FnMut(&EnvelopeItem) -> bool,
Filters the Envelope’s EnvelopeItem
s based on a predicate,
and returns a new Envelope containing only the filtered items.
Retains the EnvelopeItem
s for which the predicate returns true
.
Additionally, EnvelopeItem::Attachment
s are only kept if the Envelope
contains an EnvelopeItem::Event
or EnvelopeItem::Transaction
.
None
is returned if no items remain in the Envelope after filtering.
sourcepub fn to_writer<W>(&self, writer: W) -> Result<(), Error> where
W: Write,
pub fn to_writer<W>(&self, writer: W) -> Result<(), Error> where
W: Write,
Serialize the Envelope into the given Write
.
sourcepub fn from_slice(slice: &[u8]) -> Result<Envelope, EnvelopeError>
pub fn from_slice(slice: &[u8]) -> Result<Envelope, EnvelopeError>
Creates a new Envelope from slice.
Trait Implementations
sourceimpl From<Transaction<'static>> for Envelope
impl From<Transaction<'static>> for Envelope
sourcefn from(transaction: Transaction<'static>) -> Envelope
fn from(transaction: Transaction<'static>) -> Envelope
Converts to this type from the input type.
impl StructuralPartialEq for Envelope
Auto Trait Implementations
impl RefUnwindSafe for Envelope
impl Send for Envelope
impl Sync for Envelope
impl Unpin for Envelope
impl UnwindSafe for Envelope
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more