heapdump_vmo/
lib.rs

1// Copyright 2023 The Fuchsia Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5use thiserror::Error;
6
7pub mod allocations_table_v1;
8pub mod resources_table_v1;
9pub mod stack_trace_compression;
10
11#[derive(Debug, Eq, Error, PartialEq)]
12pub enum Error {
13    #[error("The provided memory region is too small")]
14    BufferTooSmall,
15    #[error("The provided memory region is too big")]
16    BufferTooBig,
17    #[error("Operation failed due to lack of space")]
18    OutOfSpace,
19    #[error("Operation failed because the provided input is not valid")]
20    InvalidInput,
21    #[error("System call failed: {}", .0)]
22    SyscallFailed(#[from] zx::Status),
23}
24
25impl From<memory_mapped_vmo::Error> for Error {
26    fn from(error: memory_mapped_vmo::Error) -> Self {
27        match error {
28            memory_mapped_vmo::Error::InvalidInput => Error::InvalidInput,
29        }
30    }
31}