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§
Source§impl Envelope
impl Envelope
Sourcepub fn new() -> Envelope
Available on crate feature protocol only.
pub fn new() -> Envelope
protocol only.Creates a new empty Envelope.
Sourcepub fn add_item<I>(&mut self, item: I)where
I: Into<EnvelopeItem>,
Available on crate feature protocol only.
pub fn add_item<I>(&mut self, item: I)where
I: Into<EnvelopeItem>,
protocol only.Add a new Envelope Item.
Sourcepub fn items(&self) -> EnvelopeItemIter<'_> ⓘ
Available on crate feature protocol only.
pub fn items(&self) -> EnvelopeItemIter<'_> ⓘ
protocol only.Create an Iterator over all the EnvelopeItems.
Sourcepub fn headers(&self) -> &EnvelopeHeaders
Available on crate feature protocol only.
pub fn headers(&self) -> &EnvelopeHeaders
protocol only.Returns the Envelope headers.
Sourcepub fn with_headers(self, headers: EnvelopeHeaders) -> Envelope
Available on crate feature protocol only.
pub fn with_headers(self, headers: EnvelopeHeaders) -> Envelope
protocol only.Sets the Envelope headers.
Sourcepub fn uuid(&self) -> Option<&Uuid>
Available on crate feature protocol only.
pub fn uuid(&self) -> Option<&Uuid>
protocol only.Returns the Envelopes Uuid, if any.
Sourcepub fn event(&self) -> Option<&Event<'static>>
Available on crate feature protocol only.
pub fn event(&self) -> Option<&Event<'static>>
protocol only.Returns the Event contained in this Envelope, if any.
Sourcepub fn filter<P>(self, predicate: P) -> Option<Envelope>
Available on crate feature protocol only.
pub fn filter<P>(self, predicate: P) -> Option<Envelope>
protocol only.Filters the Envelope’s EnvelopeItems based on a predicate,
and returns a new Envelope containing only the filtered items.
Retains the EnvelopeItems for which the predicate returns true.
Additionally, EnvelopeItem::Attachments 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,
Available on crate feature protocol only.
pub fn to_writer<W>(&self, writer: W) -> Result<(), Error>where
W: Write,
protocol only.Serialize the Envelope into the given Write.
Sourcepub fn from_slice(slice: &[u8]) -> Result<Envelope, EnvelopeError>
Available on crate feature protocol only.
pub fn from_slice(slice: &[u8]) -> Result<Envelope, EnvelopeError>
protocol only.Creates a new Envelope from slice.
Sourcepub fn from_bytes_raw(bytes: Vec<u8>) -> Result<Envelope, EnvelopeError>
Available on crate feature protocol only.
pub fn from_bytes_raw(bytes: Vec<u8>) -> Result<Envelope, EnvelopeError>
protocol only.Creates a new raw Envelope from the given buffer.
Sourcepub fn from_path<P>(path: P) -> Result<Envelope, EnvelopeError>
Available on crate feature protocol only.
pub fn from_path<P>(path: P) -> Result<Envelope, EnvelopeError>
protocol only.Creates a new Envelope from path.
Sourcepub fn from_path_raw<P>(path: P) -> Result<Envelope, EnvelopeError>
Available on crate feature protocol only.
pub fn from_path_raw<P>(path: P) -> Result<Envelope, EnvelopeError>
protocol only.Creates a new Envelope from path without attempting to parse anything.
The resulting Envelope will have no event_id and the file contents will
be contained verbatim in the items field.