1#![cfg_attr(not(feature = "std"), no_std)]
2
3use clang_rt_xray_sys::interface::*;
4
5pub mod raw;
6
7#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
8pub struct FunctionID(pub(crate) i32);
9
10impl FunctionID {
11 pub fn iter() -> impl Iterator<Item = Self> {
12 let max_id = unsafe { __xray_max_function_id() };
14 let max_id = i32::try_from(max_id).unwrap_or(0);
17 (1..=max_id).map(Self)
18 }
19
20 pub fn count() -> usize {
21 unsafe { __xray_max_function_id() }
23 }
24
25 pub fn address(&self) -> usize {
27 unsafe { __xray_function_address(self.0) }
29 }
30}