-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[crashtracking] Little improvements to the FFI api (#842)
* Use usize instead of string in the FFI api * Add code in example * Move around StringWrapper and co, so only one declaration/definition exist * Shorten some types name
- Loading branch information
Showing
12 changed files
with
205 additions
and
98 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,8 @@ | ||
// Copyright 2024-Present Datadog, Inc. https://www.datadoghq.com/ | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
use ddcommon_ffi::{Error, StringWrapper}; | ||
|
||
#[repr(C)] | ||
pub enum DemangleOptions { | ||
Complete, | ||
NameOnly, | ||
} | ||
|
||
#[repr(C)] | ||
pub enum StringWrapperResult { | ||
Ok(StringWrapper), | ||
#[allow(dead_code)] | ||
Err(Error), | ||
} | ||
|
||
// Useful for testing | ||
impl StringWrapperResult { | ||
pub fn unwrap(self) -> StringWrapper { | ||
match self { | ||
StringWrapperResult::Ok(s) => s, | ||
StringWrapperResult::Err(e) => panic!("{e}"), | ||
} | ||
} | ||
} | ||
|
||
impl From<anyhow::Result<String>> for StringWrapperResult { | ||
fn from(value: anyhow::Result<String>) -> Self { | ||
match value { | ||
Ok(x) => Self::Ok(x.into()), | ||
Err(err) => Self::Err(err.into()), | ||
} | ||
} | ||
} | ||
|
||
impl From<String> for StringWrapperResult { | ||
fn from(value: String) -> Self { | ||
Self::Ok(value.into()) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.