libdd_profiling/profiles/collections/
error.rs

1// Copyright 2025-Present Datadog, Inc. https://www.datadoghq.com/
2// SPDX-License-Identifier: Apache-2.0
3
4#[repr(C)]
5#[derive(Debug, thiserror::Error)]
6pub enum SetError {
7    #[error("set error: invalid argument")]
8    InvalidArgument,
9    #[error("set error: out of memory")]
10    OutOfMemory,
11}
12
13impl From<libdd_alloc::AllocError> for SetError {
14    fn from(_: libdd_alloc::AllocError) -> Self {
15        SetError::OutOfMemory
16    }
17}
18
19impl From<std::collections::TryReserveError> for SetError {
20    fn from(_: std::collections::TryReserveError) -> Self {
21        SetError::OutOfMemory
22    }
23}
24
25impl From<hashbrown::TryReserveError> for SetError {
26    fn from(_: hashbrown::TryReserveError) -> Self {
27        SetError::OutOfMemory
28    }
29}