#[path = "kind.rs"]
mod kind;
#[path = "kind_types.rs"]
mod kind_types;
pub use kind::RuntimeEventKind;
pub use kind_types::{
EvidenceWakeCause, QueueKind, StackDisposition, TaskOutcome, TimerRetirement, WakeOrigin,
WakeRejection,
};
use crate::diagnostics::{CarrierId, RuntimeId};
#[derive(
::core::clone::Clone,
::core::marker::Copy,
::core::fmt::Debug,
::core::cmp::PartialEq,
::core::cmp::Eq,
::core::cmp::PartialOrd,
::core::cmp::Ord,
::core::hash::Hash,
)]
pub struct EventSequence(u64);
impl EventSequence {
pub(crate) fn new(value: u64) -> Self {
Self(value)
}
pub fn get(self) -> u64 {
self.0
}
}
#[derive(
::core::clone::Clone,
::core::marker::Copy,
::core::fmt::Debug,
::core::cmp::PartialEq,
::core::cmp::Eq,
::core::cmp::PartialOrd,
::core::cmp::Ord,
::core::hash::Hash,
)]
pub struct WaitKey {
wait: u64,
generation: u64,
}
impl WaitKey {
pub(crate) fn from_token(token: vthread_stack::ParkToken) -> Self {
Self {
wait: token.wait(),
generation: token.generation(),
}
}
pub fn wait(self) -> u64 {
self.wait
}
pub fn generation(self) -> u64 {
self.generation
}
}
#[derive(
::core::clone::Clone,
::core::marker::Copy,
::core::fmt::Debug,
::core::cmp::PartialEq,
::core::cmp::Eq,
::core::cmp::PartialOrd,
::core::cmp::Ord,
::core::hash::Hash,
)]
pub struct StackId {
carrier: CarrierId,
local: u64,
}
impl StackId {
pub(crate) fn new(carrier: CarrierId, local: u64) -> Self {
Self { carrier, local }
}
pub fn carrier(self) -> CarrierId {
self.carrier
}
pub fn local(self) -> u64 {
self.local
}
}
#[derive(
::core::clone::Clone,
::core::marker::Copy,
::core::fmt::Debug,
::core::cmp::PartialEq,
::core::cmp::Eq,
)]
pub struct RuntimeEvent {
sequence: EventSequence,
runtime: RuntimeId,
kind: RuntimeEventKind,
}
impl RuntimeEvent {
pub(crate) fn new(sequence: u64, runtime: RuntimeId, kind: RuntimeEventKind) -> Self {
Self {
sequence: EventSequence::new(sequence),
runtime,
kind,
}
}
pub fn sequence(self) -> EventSequence {
self.sequence
}
pub fn runtime(self) -> RuntimeId {
self.runtime
}
pub fn kind(self) -> RuntimeEventKind {
self.kind
}
}
#[cfg(test)]
#[path = "event_test.rs"]
mod event_test;