pub enum EventLoopHandle {
Js {
owner: JsEventLoop,
},
Mini(BackRef<MiniEventLoop<'static>>),
}Variants§
Js
Fields
owner: JsEventLoopTyped handle wrapping the erased *mut jsc::EventLoop — see
AnyEventLoop::Js. JsEventLoop is Copy, so the handle stays
Copy.
Mini(BackRef<MiniEventLoop<'static>>)
Implementations§
Source§impl EventLoopHandle
impl EventLoopHandle
Sourcepub fn init(js_event_loop: *mut ()) -> EventLoopHandle
pub fn init(js_event_loop: *mut ()) -> EventLoopHandle
Wrap an erased *mut jsc::EventLoop.
js_event_loop is a live erased *mut jsc::EventLoop whose owner
outlives every dispatch through the returned handle. The pointer is not
dereferenced here — it’s stored opaquely in JsEventLoop and only
dereferenced at dispatch sites. A null pointer is a documented sentinel
for “never dispatched” placeholders (e.g. struct field initialisers
that are overwritten before use).
pub fn init_mini(mini: *mut MiniEventLoop<'static>) -> EventLoopHandle
pub fn as_event_loop_ctx(self) -> EventLoopCtx
Sourcepub fn into_tag_ptr(self) -> (i8, *mut c_void)
pub fn into_tag_ptr(self) -> (i8, *mut c_void)
Erase to the (tag, ptr) pair stored in uws::InternalLoopData
(parent_tag / parent_ptr). Tag 1 = JS, tag 2 = mini — matches Zig
setParentEventLoop.
Sourcepub unsafe fn from_tag_ptr(tag: i8, ptr: *mut c_void) -> EventLoopHandle
pub unsafe fn from_tag_ptr(tag: i8, ptr: *mut c_void) -> EventLoopHandle
Inverse of [into_tag_ptr] — recover from the (tag, ptr) pair stored
in uws::InternalLoopData (Zig: loop.internal_loop_data.getParent()).
(tag, ptr) must have been produced by [into_tag_ptr] on a still-live
event loop (i.e. read from internal_loop_data while the loop is alive).
§Safety
(tag, ptr) must have been produced by [into_tag_ptr] on a still-live
event loop. The constructor itself only stores the opaque pointer, but
dispatch through the resulting handle dereferences it — this fn is the
last place the precondition can be discharged. (NOT eligible for
unsafe-fn-narrow: the invariant is caller-provided, not internally
guarded.)
Source§impl EventLoopHandle
impl EventLoopHandle
Sourcepub fn set_as_parent_of(self, uws_loop: &mut PosixLoop)
pub fn set_as_parent_of(self, uws_loop: &mut PosixLoop)
Zig: loop.internal_loop_data.setParentEventLoop(jsc.EventLoopHandle.init(..)).
Convenience wrapper so callers don’t need both bun_uws::InternalLoopDataExt
(the trait) and the *mut Loop deref dance in scope. uws_loop is the
process-global loop returned by AnyEventLoop::r#loop() — never null.
pub fn from_any(any: &mut AnyEventLoop<'static>) -> EventLoopHandle
Sourcepub fn js_current() -> EventLoopHandle
pub fn js_current() -> EventLoopHandle
EventLoopHandle for the current thread’s JS event loop. Replaces
jsc::EventLoopHandle.init(jsc::VirtualMachine.get()) for tier-≤4 callers.
Sourcepub fn global_object(self) -> *mut ()
pub fn global_object(self) -> *mut ()
Erased *mut jsc::JSGlobalObject or null (Mini has no JS global).
pub fn enter(self)
pub fn exit(self)
Sourcepub fn entered(self) -> EnteredEventLoop
pub fn entered(self) -> EnteredEventLoop
enter() and return an RAII guard that exit()s on drop. Prefer this
over a bare enter()/exit() pair so early returns and ? don’t leak
the entered scope.
Sourcepub fn file_polls(self) -> *mut Store
pub fn file_polls(self) -> *mut Store
Returns the FilePoll store as a raw pointer (mirrors Zig *FilePoll.Store).
EventLoopHandle is Copy; promoting to &'static mut would let two
calls produce aliased exclusive references (UB). Callers deref locally
for the brief region they need &mut.
pub fn put_file_poll(&mut self, poll: &mut FilePoll)
pub fn enqueue_task_concurrent(self, task: EventLoopTaskPtr)
pub fn loop(self) -> *mut PosixLoop
pub fn platform_event_loop(self) -> *mut PosixLoop
Sourcepub fn loop_(self) -> *mut PosixLoop
pub fn loop_(self) -> *mut PosixLoop
Alias for r#loop so callers spell handle.loop_()
without the raw-identifier escape (Zig: handle.loop()).
Sourcepub fn native_loop(self) -> *mut PosixLoop
pub fn native_loop(self) -> *mut PosixLoop
Platform-native loop pointer (us_loop_t* on POSIX, uv_loop_t* on
Windows). See bun_io::uws_to_native — collapses the per-site
#[cfg(windows)] .uv_loop projection that previously appeared at
every BufferedReaderParent::loop_ impl.
Sourcepub fn pipe_read_buffer(self) -> *mut [u8]
pub fn pipe_read_buffer(self) -> *mut [u8]
Returns the shared pipe-read scratch buffer as a raw fat ptr (mirrors
Zig []u8). Same Copy-handle aliasing concern as [file_polls].
pub fn ref_(self)
pub fn unref(self)
pub fn env(self) -> *mut Loader<'static>
pub fn top_level_dir(self) -> &'static [u8] ⓘ
pub fn create_null_delimited_env_map( self, ) -> Result<NullDelimitedEnvMap, AllocError>
Trait Implementations§
Source§impl Clone for EventLoopHandle
impl Clone for EventLoopHandle
Source§fn clone(&self) -> EventLoopHandle
fn clone(&self) -> EventLoopHandle
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for EventLoopHandle
Source§impl ParentEventLoopHandle for EventLoopHandle
Carrier-trait impl so bun_uws::InternalLoopDataExt::set_parent_event_loop
accepts EventLoopHandle directly. Kept here (not in bun_uws) because
bun_uws is a lower tier than bun_event_loop and cannot name this enum.
impl ParentEventLoopHandle for EventLoopHandle
Carrier-trait impl so bun_uws::InternalLoopDataExt::set_parent_event_loop
accepts EventLoopHandle directly. Kept here (not in bun_uws) because
bun_uws is a lower tier than bun_event_loop and cannot name this enum.
Auto Trait Implementations§
impl !RefUnwindSafe for EventLoopHandle
impl !Send for EventLoopHandle
impl !Sync for EventLoopHandle
impl !UnwindSafe for EventLoopHandle
impl Freeze for EventLoopHandle
impl Unpin for EventLoopHandle
impl UnsafeUnpin for EventLoopHandle
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.