use std::ops::Range;
pub const MAX_TIMESTAMP_COUNTERS: usize = metal_rust_ffi::MAX_TIMESTAMP_COUNTERS;
pub struct TimestampCounterHeap {
pub(crate) inner: metal_rust_ffi::TimestampCounterHeap,
}
pub struct CounterReadback {
pub(crate) inner: metal_rust_ffi::CounterReadback,
}
impl TimestampCounterHeap {
pub(crate) const fn from_ffi(inner: metal_rust_ffi::TimestampCounterHeap) -> Self {
Self { inner }
}
#[must_use]
pub const fn count(&self) -> usize {
self.inner.count()
}
pub fn label(&self) -> Result<Option<String>, crate::Error> {
self.inner.label().map_err(crate::Error::from_ffi)
}
pub fn set_label(&self, label: Option<&str>) -> Result<(), crate::Error> {
self.inner.set_label(label).map_err(crate::Error::from_ffi)
}
pub fn heap_type(&self) -> Result<crate::metal4::CounterHeapType, crate::Error> {
self.inner.heap_type().map_err(crate::Error::from_ffi)
}
pub fn invalidate_range(&mut self, range: Range<usize>) -> Result<(), crate::Error> {
self.inner
.invalidate_range(range)
.map_err(crate::Error::from_ffi)
}
}