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

Get underlying data as &[u8].

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

Converts this type into a shared reference of the (usually inferred) input type.

Formats the value using the given formatter. Read more

Executes the destructor for this type. Read more

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. Read more

This method returns an Ordering between self and other. Read more

Compares and returns the maximum of two values. Read more

Compares and returns the minimum of two values. Read more

Restrict a value to a certain interval. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

This method returns an ordering between self and other values if one exists. Read more

This method tests less than (for self and other) and is used by the < operator. Read more

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

This method tests greater than (for self and other) and is used by the > operator. Read more

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.