Struct sentry_contrib_native::Envelope
source · [−]pub struct Envelope { /* private fields */ }
Expand description
The actual body which transports send to Sentry.
Examples
struct CustomTransport {
#[cfg(feature = "transport-custom")]
dsn: Dsn,
};
impl Transport for CustomTransport {
fn send(&self, raw_envelope: RawEnvelope) {
// serialize it, maybe move this to another thread to prevent blocking
let envelope: Envelope = raw_envelope.serialize();
// look at that body!
println!("{:?}", envelope.as_bytes());
// let's build the whole `Request`
#[cfg(feature = "transport-custom")]
let request: Request = envelope.into_request(self.dsn.clone());
}
}
Implementations
sourceimpl Envelope
impl Envelope
sourcepub fn as_bytes(&self) -> &[u8]ⓘNotable traits for &'_ [u8]impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
pub fn as_bytes(&self) -> &[u8]ⓘNotable traits for &'_ [u8]impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
Get underlying data as &[u8]
.
sourcepub fn into_request(self, dsn: Dsn) -> Request
pub fn into_request(self, dsn: Dsn) -> Request
Constructs a HTTP request for the provided sys::Envelope
with the
DSN that was registered with the SDK.
The return value has all of the necessary pieces of data to create a HTTP request with the HTTP client of your choice:
- The URL to send the request to.
- The headers that must be set.
- The body of the request.
The content-length
header is already set for you, though some HTTP
clients will automatically overwrite it, which should be fine.
The body
in the request is an Envelope
, which implements
AsRef<[u8]>
to retrieve the actual bytes that should be sent as the
body.
Trait Implementations
sourceimpl Ord for Envelope
impl Ord for Envelope
sourceimpl PartialOrd<Envelope> for Envelope
impl PartialOrd<Envelope> for Envelope
sourcefn partial_cmp(&self, other: &Envelope) -> Option<Ordering>
fn partial_cmp(&self, other: &Envelope) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
impl Eq for Envelope
impl Send for Envelope
impl StructuralEq for Envelope
impl StructuralPartialEq for Envelope
impl Sync for Envelope
Auto Trait Implementations
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