Struct sentry_contrib_native::Envelope[][src]

pub struct Envelope { /* fields omitted */ }

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

impl Envelope[src]

#[must_use]
pub fn as_bytes(&self) -> &[u8]
[src]

Get underlying data as &[u8].

#[must_use = "`Request` doesn't do anything until it is sent"]
pub fn into_request(self, dsn: Dsn) -> Request
[src]

This is supported on crate feature transport-custom only.

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

impl AsRef<[u8]> for Envelope[src]

impl Debug for Envelope[src]

impl Drop for Envelope[src]

impl Eq for Envelope[src]

impl Hash for Envelope[src]

impl Ord for Envelope[src]

impl PartialEq<Envelope> for Envelope[src]

impl PartialOrd<Envelope> for Envelope[src]

impl Send for Envelope[src]

impl StructuralEq for Envelope[src]

impl StructuralPartialEq for Envelope[src]

impl Sync for Envelope[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.