pub struct BaoTimerRegistry { /* private fields */ }Expand description
P1-A.3c-step2: BaoTimerRegistry — the SpiderMonkey-side equivalent of
Bun’s runtime::timer::All. Owns Box<BaoTimeoutObject> nodes keyed by
timer_id and tracks them in an intrusive pairing-heap of their
EventLoopTimer slots. Single-thread (JS model) → no Mutex.
Lifetime note: stored in a thread_local RefCell, so any re-entrant
schedule/cancel/drain must avoid holding &mut across JS callback
dispatch — same pattern as Bun’s drain_timers (drops the borrow before
firing).
Implementations§
Source§impl BaoTimerRegistry
impl BaoTimerRegistry
pub fn new() -> BaoTimerRegistry
pub fn is_empty(&self) -> bool
Sourcepub fn insert(&mut self, obj: Box<BaoTimeoutObject>) -> u32
pub fn insert(&mut self, obj: Box<BaoTimeoutObject>) -> u32
Take ownership of obj, register it under obj.timer_id, and push
its event_loop_timer into the intrusive heap. Returns the timer_id.
§Panics
Panics if timer_id is already registered (caller must cancel first).
Sourcepub fn remove(&mut self, id: u32) -> Option<Box<BaoTimeoutObject>>
pub fn remove(&mut self, id: u32) -> Option<Box<BaoTimeoutObject>>
Remove timer id from both the heap and the owned map. Returns
ownership of the removed BaoTimeoutObject, or None if not found.
Sourcepub fn next_deadline(&self) -> Option<Timespec>
pub fn next_deadline(&self) -> Option<Timespec>
Peek the earliest deadline in the heap (Bun’s get_timeout analog).
Trait Implementations§
Source§impl Default for BaoTimerRegistry
impl Default for BaoTimerRegistry
Source§fn default() -> BaoTimerRegistry
fn default() -> BaoTimerRegistry
Auto Trait Implementations§
impl !Send for BaoTimerRegistry
impl !Sync for BaoTimerRegistry
impl Freeze for BaoTimerRegistry
impl RefUnwindSafe for BaoTimerRegistry
impl Unpin for BaoTimerRegistry
impl UnsafeUnpin for BaoTimerRegistry
impl UnwindSafe for BaoTimerRegistry
Blanket Implementations§
Source§impl<T> AsCtxPtr for Twhere
T: ?Sized,
impl<T> AsCtxPtr for Twhere
T: ?Sized,
Source§fn as_ctx_ptr(&self) -> *mut Selfwhere
Self: Sized,
fn as_ctx_ptr(&self) -> *mut Selfwhere
Self: Sized,
self’s address as *mut Self for deferred-task / scopeguard /
ref_guard ctx slots. The closures/trampolines deref it as shared
(&*p) — every method they reach is &self post-R-2, so no write
provenance is required; the *mut spelling is purely to match the
existing DerefOnDrop / HasAutoFlush / RefCount ABI.Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> Filterable for T
impl<T> Filterable for T
Source§fn filterable(
self,
filter_name: &'static str,
) -> RequestFilterDataProvider<T, fn(DataRequest<'_>) -> bool>
fn filterable( self, filter_name: &'static str, ) -> RequestFilterDataProvider<T, fn(DataRequest<'_>) -> bool>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more