Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(profiling)!: create FFI Error type and remove *Result_drop methods #95

Merged
merged 10 commits into from
Jan 27, 2023

Commits on Jan 25, 2023

  1. refactor(profiling)!: create FFI Error type

    This extracts an FFI Error type `ddog_Error`. It contains an FFI Vec
    internally:
    
    ```rust
    /// Please treat this as opaque; do not reach into it, and especially
    /// don't write into it!
    pub struct Error {
        /// This is a String stuffed into the vec.
        message: Vec<u8>,
    }
    ```
    
    FFI result types have been updated e.g.:
    
    ```rust
    pub enum SendResult {
        HttpResponse(HttpStatus),
        Err(Error),
    }
    ```
    
    Instead of reaching into the buffer, use these APIs:
    
    ```c
    /**
     * # Safety
     * Only pass null or a valid reference to an Error.
     */
    void ddog_Error_drop(struct ddog_Error *error);
    
    /**
     * Returns a CharSlice of the error's message that is valid until the error
     * is dropped.
     * # Safety
     * Only pass null or a valid reference to an Error.
     */
    ddog_CharSlice ddog_Error_message(const struct ddog_Error *error);
    ```
    morrisonlevi committed Jan 25, 2023
    Configuration menu
    Copy the full SHA
    9b51061 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    9c57983 View commit details
    Browse the repository at this point in the history

Commits on Jan 26, 2023

  1. Drop *Result_drop functions

    I think API usage is more likely to be correct when each case is
    dropped as needed. This shows the diff for our examples.
    morrisonlevi committed Jan 26, 2023
    Configuration menu
    Copy the full SHA
    0b7899b View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    f36696f View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    e130a2c View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    15626b9 View commit details
    Browse the repository at this point in the history

Commits on Jan 27, 2023

  1. Configuration menu
    Copy the full SHA
    ae15ef2 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    05555e4 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    ccaceb2 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    f47f2a0 View commit details
    Browse the repository at this point in the history