#[derive(Debug)]
pub struct Event(__itt_event);
impl<'a> From<&'a str> for Event
{
#[inline(always)]
fn from(name: &'a str) -> Self
{
Self::new(name)
}
}
impl Event
{
#[cfg(unix)]
#[inline(always)]
pub fn new(name: &str) -> Self
{
Event(unsafe { __itt_event_create(name.as_bytes().as_ptr() as *const i8, name.len() as i32) })
}
#[cfg(windows)]
#[inline(always)]
pub fn new(name: &str) -> Self
{
Event(unsafe { __itt_event_createA(name.as_bytes().as_ptr() as *const i8, name.len() as i32) })
}
#[inline(always)]
pub fn ping(&self)
{
unsafe { __itt_event_start(self.0) };
}
#[inline(always)]
pub fn start<'a>(&'a mut self) -> StartedEvent<'a>
{
unsafe { __itt_event_start(self.0) };
StartedEvent(self.0, false, PhantomData)
}
}