wit-bindgen
Advanced tools
| { | ||
| "git": { | ||
| "sha1": "ba933bda98214ffe2ae16c63b2b91d0932021bbc" | ||
| "sha1": "6f8b8e75254174353fc27c269827c4c239d51eff" | ||
| }, | ||
| "path_in_vcs": "crates/guest-rust" | ||
| } |
+7
-7
@@ -352,3 +352,3 @@ # This file is automatically @generated by Cargo. | ||
| name = "wit-bindgen" | ||
| version = "0.49.0" | ||
| version = "0.50.0" | ||
| dependencies = [ | ||
@@ -364,5 +364,5 @@ "bitflags", | ||
| name = "wit-bindgen-core" | ||
| version = "0.49.0" | ||
| version = "0.50.0" | ||
| source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| checksum = "886e8e938e4e9fe54143c080cbb99d7db5d19242b62ef225dbb28e17b3223bd8" | ||
| checksum = "6ee98d5747ec63897e51101c8cafad569cc639346332c0378772ef4baeea8ed2" | ||
| dependencies = [ | ||
@@ -376,5 +376,5 @@ "anyhow", | ||
| name = "wit-bindgen-rust" | ||
| version = "0.49.0" | ||
| version = "0.50.0" | ||
| source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| checksum = "145cac8fb12d99aea13a3f9e0d07463fa030edeebab2c03805eda0e1cc229bba" | ||
| checksum = "8596d6a44bcc2b66e99213c342a85ff72be1109972f5353bb07d05a890a0c257" | ||
| dependencies = [ | ||
@@ -393,5 +393,5 @@ "anyhow", | ||
| name = "wit-bindgen-rust-macro" | ||
| version = "0.49.0" | ||
| version = "0.50.0" | ||
| source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| checksum = "6042452ac4e58891cdb6321bb98aabb9827dbaf6f4e971734d8dd86813319aea" | ||
| checksum = "098fd8b2c4bab0052159a87d02acad740a9c809afe9dcf5bd0b92eb3f63da154" | ||
| dependencies = [ | ||
@@ -398,0 +398,0 @@ "anyhow", |
+5
-4
@@ -13,6 +13,6 @@ # THIS FILE IS AUTOMATICALLY GENERATED BY CARGO | ||
| [package] | ||
| edition = "2021" | ||
| rust-version = "1.82.0" | ||
| edition = "2024" | ||
| rust-version = "1.87.0" | ||
| name = "wit-bindgen" | ||
| version = "0.49.0" | ||
| version = "0.50.0" | ||
| authors = ["Alex Crichton <alex@alexcrichton.com>"] | ||
@@ -33,2 +33,3 @@ build = "build.rs" | ||
| repository = "https://github.com/bytecodealliance/wit-bindgen" | ||
| resolver = "2" | ||
@@ -87,3 +88,3 @@ [package.metadata.docs.rs] | ||
| [dependencies.wit-bindgen-rust-macro] | ||
| version = "0.49.0" | ||
| version = "0.50.0" | ||
| optional = true |
+7
-10
@@ -876,16 +876,13 @@ //! Bindings generation support for Rust with the Component Model. | ||
| #[cfg(feature = "async")] | ||
| #[allow(deprecated)] | ||
| pub use rt::async_support::backpressure_set; | ||
| #[cfg(feature = "inter-task-wakeup")] | ||
| pub use rt::async_support::UnitStreamOps; | ||
| #[cfg(feature = "async-spawn")] | ||
| pub use rt::async_support::spawn; | ||
| #[cfg(feature = "inter-task-wakeup")] | ||
| pub use rt::async_support::UnitStreamOps; | ||
| #[cfg(feature = "async")] | ||
| pub use rt::async_support::{ | ||
| backpressure_dec, backpressure_inc, block_on, yield_async, yield_blocking, AbiBuffer, | ||
| FutureOps, FutureRead, FutureReader, FutureWrite, FutureWriteCancel, FutureWriteError, | ||
| FutureWriter, RawFutureRead, RawFutureReader, RawFutureWrite, RawFutureWriter, RawStreamRead, | ||
| RawStreamReader, RawStreamWrite, RawStreamWriter, StreamOps, StreamRead, StreamReader, | ||
| StreamResult, StreamWrite, StreamWriter, | ||
| AbiBuffer, FutureOps, FutureRead, FutureReader, FutureWrite, FutureWriteCancel, | ||
| FutureWriteError, FutureWriter, RawFutureRead, RawFutureReader, RawFutureWrite, | ||
| RawFutureWriter, RawStreamRead, RawStreamReader, RawStreamWrite, RawStreamWriter, StreamOps, | ||
| StreamRead, StreamReader, StreamResult, StreamWrite, StreamWriter, backpressure_dec, | ||
| backpressure_inc, block_on, yield_async, yield_blocking, | ||
| }; |
+29
-43
@@ -34,3 +34,3 @@ #![deny(missing_docs)] | ||
| $(#[$extern_attr:meta])* | ||
| extern "C" { | ||
| unsafe extern "C" { | ||
| $( | ||
@@ -52,3 +52,3 @@ $(#[$func_attr:meta])* | ||
| $(#[$extern_attr])* | ||
| extern "C" { | ||
| unsafe extern "C" { | ||
| $( | ||
@@ -219,5 +219,5 @@ $(#[$func_attr])* | ||
| let mut context = Context::from_waker(&me.waker_clone); | ||
| loop { | ||
| let mut context = Context::from_waker(&me.waker_clone); | ||
| loop { | ||
| // On each turn of this loop reset the state to "polling" | ||
@@ -261,4 +261,8 @@ // which clears out any pending wakeup if one was sent. This | ||
| if me.remaining_work() { | ||
| let waitable = me.waitable_set.as_ref().unwrap().as_raw(); | ||
| break CallbackCode::Poll(waitable); | ||
| let (event0, event1, event2) = | ||
| me.waitable_set.as_ref().unwrap().poll(); | ||
| if event0 != EVENT_NONE { | ||
| me.deliver_waitable_event(event1, event2); | ||
| continue; | ||
| } | ||
| } | ||
@@ -351,6 +355,8 @@ break CallbackCode::Yield; | ||
| assert!(!ptr.is_null()); | ||
| (*ptr).add_waitable(waitable); | ||
| match (*ptr).waitables.insert(waitable, (callback_ptr, callback)) { | ||
| Some((prev, _)) => prev, | ||
| None => ptr::null_mut(), | ||
| unsafe { | ||
| (*ptr).add_waitable(waitable); | ||
| match (*ptr).waitables.insert(waitable, (callback_ptr, callback)) { | ||
| Some((prev, _)) => prev, | ||
| None => ptr::null_mut(), | ||
| } | ||
| } | ||
@@ -362,6 +368,8 @@ } | ||
| assert!(!ptr.is_null()); | ||
| (*ptr).remove_waitable(waitable); | ||
| match (*ptr).waitables.remove(&waitable) { | ||
| Some((prev, _)) => prev, | ||
| None => ptr::null_mut(), | ||
| unsafe { | ||
| (*ptr).remove_waitable(waitable); | ||
| match (*ptr).waitables.remove(&waitable) { | ||
| Some((prev, _)) => prev, | ||
| None => ptr::null_mut(), | ||
| } | ||
| } | ||
@@ -420,3 +428,2 @@ } | ||
| Wait(u32), | ||
| Poll(u32), | ||
| } | ||
@@ -430,3 +437,2 @@ | ||
| CallbackCode::Wait(waitable) => 2 | (waitable << 4), | ||
| CallbackCode::Poll(waitable) => 3 | (waitable << 4), | ||
| } | ||
@@ -553,5 +559,3 @@ } | ||
| } | ||
| CallbackCode::Yield | CallbackCode::Poll(_) => { | ||
| event = state.waitable_set.as_ref().unwrap().poll() | ||
| } | ||
| CallbackCode::Yield => event = state.waitable_set.as_ref().unwrap().poll(), | ||
| CallbackCode::Wait(_) => event = state.waitable_set.as_ref().unwrap().wait(), | ||
@@ -585,3 +589,3 @@ } | ||
| #[link(wasm_import_module = "$root")] | ||
| extern "C" { | ||
| unsafe extern "C" { | ||
| #[link_name = "[thread-yield]"] | ||
@@ -635,20 +639,2 @@ fn yield_() -> bool; | ||
| /// Call the `backpressure.set` canonical built-in function. | ||
| /// | ||
| /// When `enabled` is `true`, this tells the host to defer any new calls to this | ||
| /// component instance until further notice (i.e. until `backpressure.set` is | ||
| /// called again with `enabled` set to `false`). | ||
| #[deprecated = "use backpressure_{inc,dec} instead"] | ||
| pub fn backpressure_set(enabled: bool) { | ||
| extern_wasm! { | ||
| #[link(wasm_import_module = "$root")] | ||
| extern "C" { | ||
| #[link_name = "[backpressure-set]"] | ||
| fn backpressure_set(_: i32); | ||
| } | ||
| } | ||
| unsafe { backpressure_set(if enabled { 1 } else { 0 }) } | ||
| } | ||
| /// Call the `backpressure.inc` canonical built-in function. | ||
@@ -658,3 +644,3 @@ pub fn backpressure_inc() { | ||
| #[link(wasm_import_module = "$root")] | ||
| extern "C" { | ||
| unsafe extern "C" { | ||
| #[link_name = "[backpressure-inc]"] | ||
@@ -672,3 +658,3 @@ fn backpressure_inc(); | ||
| #[link(wasm_import_module = "$root")] | ||
| extern "C" { | ||
| unsafe extern "C" { | ||
| #[link_name = "[backpressure-dec]"] | ||
@@ -685,3 +671,3 @@ fn backpressure_dec(); | ||
| #[link(wasm_import_module = "$root")] | ||
| extern "C" { | ||
| unsafe extern "C" { | ||
| #[link_name = "[context-get-0]"] | ||
@@ -698,3 +684,3 @@ fn get() -> *mut u8; | ||
| #[link(wasm_import_module = "$root")] | ||
| extern "C" { | ||
| unsafe extern "C" { | ||
| #[link_name = "[context-set-0]"] | ||
@@ -729,3 +715,3 @@ fn set(value: *mut u8); | ||
| #[link(wasm_import_module = "[export]$root")] | ||
| extern "C" { | ||
| unsafe extern "C" { | ||
| #[link_name = "[task-cancel]"] | ||
@@ -732,0 +718,0 @@ fn cancel(); |
@@ -0,3 +1,3 @@ | ||
| use crate::rt::Cleanup; | ||
| use crate::rt::async_support::StreamOps; | ||
| use crate::rt::Cleanup; | ||
| use std::alloc::Layout; | ||
@@ -4,0 +4,0 @@ use std::mem::{self, MaybeUninit}; |
@@ -50,3 +50,3 @@ //! Definition of the "C ABI" of how imported functions interact with exported | ||
| extern_wasm! { | ||
| extern "C" { | ||
| unsafe extern "C" { | ||
| /// Sets the global task pointer to `ptr` provided. Returns the previous | ||
@@ -53,0 +53,0 @@ /// value. |
@@ -75,3 +75,3 @@ //! Raw bindings to `error-context` in the canonical ABI. | ||
| #[link(wasm_import_module = "$root")] | ||
| extern "C" { | ||
| unsafe extern "C" { | ||
| #[link_name = "[error-context-new-utf8]"] | ||
@@ -78,0 +78,0 @@ fn new(_: *const u8, _: usize) -> u32; |
@@ -114,5 +114,5 @@ //! Runtime support for `future<T>` in the component model. | ||
| use crate::rt::Cleanup; | ||
| use crate::rt::async_support::ReturnCode; | ||
| use crate::rt::async_support::waitable::{WaitableOp, WaitableOperation}; | ||
| use crate::rt::async_support::ReturnCode; | ||
| use crate::rt::Cleanup; | ||
| use std::alloc::Layout; | ||
@@ -223,27 +223,27 @@ use std::fmt; | ||
| unsafe fn lower(&mut self, payload: Self::Payload, dst: *mut u8) { | ||
| (self.lower)(payload, dst) | ||
| unsafe { (self.lower)(payload, dst) } | ||
| } | ||
| unsafe fn dealloc_lists(&mut self, dst: *mut u8) { | ||
| (self.dealloc_lists)(dst) | ||
| unsafe { (self.dealloc_lists)(dst) } | ||
| } | ||
| unsafe fn lift(&mut self, dst: *mut u8) -> Self::Payload { | ||
| (self.lift)(dst) | ||
| unsafe { (self.lift)(dst) } | ||
| } | ||
| unsafe fn start_write(&mut self, future: u32, val: *const u8) -> u32 { | ||
| (self.start_write)(future, val) | ||
| unsafe { (self.start_write)(future, val) } | ||
| } | ||
| unsafe fn start_read(&mut self, future: u32, val: *mut u8) -> u32 { | ||
| (self.start_read)(future, val) | ||
| unsafe { (self.start_read)(future, val) } | ||
| } | ||
| unsafe fn cancel_read(&mut self, future: u32) -> u32 { | ||
| (self.cancel_read)(future) | ||
| unsafe { (self.cancel_read)(future) } | ||
| } | ||
| unsafe fn cancel_write(&mut self, future: u32) -> u32 { | ||
| (self.cancel_write)(future) | ||
| unsafe { (self.cancel_write)(future) } | ||
| } | ||
| unsafe fn drop_readable(&mut self, future: u32) { | ||
| (self.drop_readable)(future) | ||
| unsafe { (self.drop_readable)(future) } | ||
| } | ||
| unsafe fn drop_writable(&mut self, future: u32) { | ||
| (self.drop_writable)(future) | ||
| unsafe { (self.drop_writable)(future) } | ||
| } | ||
@@ -264,3 +264,3 @@ } | ||
| let (tx, rx) = unsafe { raw_future_new(vtable) }; | ||
| (FutureWriter::new(tx, default), rx) | ||
| (unsafe { FutureWriter::new(tx, default) }, rx) | ||
| } | ||
@@ -267,0 +267,0 @@ |
@@ -5,3 +5,3 @@ //! For a high-level overview of how this module is implemented see the | ||
| use crate::rt::async_support::waitable::{WaitableOp, WaitableOperation}; | ||
| use crate::rt::async_support::{AbiBuffer, ReturnCode, DROPPED}; | ||
| use crate::rt::async_support::{AbiBuffer, DROPPED, ReturnCode}; | ||
| use { | ||
@@ -130,3 +130,3 @@ crate::rt::Cleanup, | ||
| if let Some(f) = self.lower { | ||
| f(payload, dst) | ||
| unsafe { f(payload, dst) } | ||
| } | ||
@@ -136,25 +136,25 @@ } | ||
| if let Some(f) = self.dealloc_lists { | ||
| f(dst) | ||
| unsafe { f(dst) } | ||
| } | ||
| } | ||
| unsafe fn lift(&mut self, dst: *mut u8) -> Self::Payload { | ||
| (self.lift.unwrap())(dst) | ||
| unsafe { (self.lift.unwrap())(dst) } | ||
| } | ||
| unsafe fn start_write(&mut self, stream: u32, val: *const u8, amt: usize) -> u32 { | ||
| (self.start_write)(stream, val, amt) | ||
| unsafe { (self.start_write)(stream, val, amt) } | ||
| } | ||
| unsafe fn start_read(&mut self, stream: u32, val: *mut u8, amt: usize) -> u32 { | ||
| (self.start_read)(stream, val, amt) | ||
| unsafe { (self.start_read)(stream, val, amt) } | ||
| } | ||
| unsafe fn cancel_read(&mut self, stream: u32) -> u32 { | ||
| (self.cancel_read)(stream) | ||
| unsafe { (self.cancel_read)(stream) } | ||
| } | ||
| unsafe fn cancel_write(&mut self, stream: u32) -> u32 { | ||
| (self.cancel_write)(stream) | ||
| unsafe { (self.cancel_write)(stream) } | ||
| } | ||
| unsafe fn drop_readable(&mut self, stream: u32) { | ||
| (self.drop_readable)(stream) | ||
| unsafe { (self.drop_readable)(stream) } | ||
| } | ||
| unsafe fn drop_writable(&mut self, stream: u32) { | ||
| (self.drop_writable)(stream) | ||
| unsafe { (self.drop_writable)(stream) } | ||
| } | ||
@@ -161,0 +161,0 @@ } |
@@ -10,2 +10,3 @@ //! Bindings used to manage subtasks, or invocations of imported functions. | ||
| use crate::rt::Cleanup; | ||
| use crate::rt::async_support::waitable::{WaitableOp, WaitableOperation}; | ||
@@ -16,3 +17,2 @@ use crate::rt::async_support::{ | ||
| }; | ||
| use crate::rt::Cleanup; | ||
| use std::alloc::Layout; | ||
@@ -280,3 +280,3 @@ use std::future::Future; | ||
| #[link(wasm_import_module = "$root")] | ||
| extern "C" { | ||
| unsafe extern "C" { | ||
| #[link_name = "[subtask-cancel]"] | ||
@@ -283,0 +283,0 @@ fn cancel(handle: u32) -> u32; |
@@ -14,3 +14,3 @@ use crate::rt::async_support::raw_stream_new; | ||
| #[link(wasm_import_module = "$root")] | ||
| extern "C" { | ||
| unsafe extern "C" { | ||
| #[link_name = "[stream-new-unit]"] | ||
@@ -17,0 +17,0 @@ fn unit_new() -> u64; |
@@ -70,3 +70,3 @@ //! Low-level FFI-like bindings around `waitable-set` in the canonical ABI. | ||
| #[link(wasm_import_module = "$root")] | ||
| extern "C" { | ||
| unsafe extern "C" { | ||
| #[link_name = "[waitable-set-new]"] | ||
@@ -73,0 +73,0 @@ fn new() -> u32; |
@@ -207,3 +207,3 @@ //! Generic support for "any waitable" and performing asynchronous operations on | ||
| unsafe extern "C" fn cabi_wake(ptr: *mut c_void, code: u32) { | ||
| let ptr: &mut CompletionStatus = &mut *ptr.cast::<CompletionStatus>(); | ||
| let ptr: &mut CompletionStatus = unsafe { &mut *ptr.cast::<CompletionStatus>() }; | ||
| ptr.code = Some(code); | ||
@@ -401,3 +401,3 @@ ptr.waker.take().unwrap().wake() | ||
| Poll::Ready(result) => { | ||
| return self.as_mut().pin_project().0.result_into_cancel(result) | ||
| return self.as_mut().pin_project().0.result_into_cancel(result); | ||
| } | ||
@@ -404,0 +404,0 @@ |
+14
-12
@@ -84,3 +84,3 @@ use core::alloc::Layout; | ||
| { | ||
| extern "C" { | ||
| unsafe extern "C" { | ||
| fn cabi_realloc( | ||
@@ -121,15 +121,17 @@ old_ptr: *mut u8, | ||
| ) -> *mut u8 { | ||
| use alloc::alloc::{alloc as allocate, handle_alloc_error, realloc, Layout}; | ||
| use alloc::alloc::{Layout, alloc as allocate, handle_alloc_error, realloc}; | ||
| let layout; | ||
| let ptr = if old_len == 0 { | ||
| if new_len == 0 { | ||
| return align as *mut u8; | ||
| let ptr = unsafe { | ||
| if old_len == 0 { | ||
| if new_len == 0 { | ||
| return align as *mut u8; | ||
| } | ||
| layout = Layout::from_size_align_unchecked(new_len, align); | ||
| allocate(layout) | ||
| } else { | ||
| debug_assert_ne!(new_len, 0, "non-zero old_len requires non-zero new_len!"); | ||
| layout = Layout::from_size_align_unchecked(old_len, align); | ||
| realloc(old_ptr, layout, new_len) | ||
| } | ||
| layout = Layout::from_size_align_unchecked(new_len, align); | ||
| allocate(layout) | ||
| } else { | ||
| debug_assert_ne!(new_len, 0, "non-zero old_len requires non-zero new_len!"); | ||
| layout = Layout::from_size_align_unchecked(old_len, align); | ||
| realloc(old_ptr, layout, new_len) | ||
| }; | ||
@@ -169,3 +171,3 @@ if ptr.is_null() { | ||
| // running ctors. | ||
| extern "C" { | ||
| unsafe extern "C" { | ||
| fn __wasm_call_ctors(); | ||
@@ -172,0 +174,0 @@ } |
@@ -5,7 +5,7 @@ // This file is generated by ./ci/rebuild-libwit-bindgen-cabi.sh | ||
| extern void *cabi_realloc_wit_bindgen_0_49_0(void *ptr, size_t old_size, size_t align, size_t new_size); | ||
| extern void *cabi_realloc_wit_bindgen_0_50_0(void *ptr, size_t old_size, size_t align, size_t new_size); | ||
| __attribute__((__weak__, __export_name__("cabi_realloc"))) | ||
| void *cabi_realloc(void *ptr, size_t old_size, size_t align, size_t new_size) { | ||
| return cabi_realloc_wit_bindgen_0_49_0(ptr, old_size, align, new_size); | ||
| return cabi_realloc_wit_bindgen_0_50_0(ptr, old_size, align, new_size); | ||
| } |
| // This file is generated by ./ci/rebuild-libwit-bindgen-cabi.sh | ||
| #[unsafe(no_mangle)] | ||
| pub unsafe extern "C" fn cabi_realloc_wit_bindgen_0_49_0( | ||
| pub unsafe extern "C" fn cabi_realloc_wit_bindgen_0_50_0( | ||
| old_ptr: *mut u8, | ||
@@ -10,3 +10,3 @@ old_len: usize, | ||
| ) -> *mut u8 { | ||
| crate::rt::cabi_realloc(old_ptr, old_len, align, new_len) | ||
| unsafe { crate::rt::cabi_realloc(old_ptr, old_len, align, new_len) } | ||
| } |
| // This file is generated by ./ci/rebuild-libwit-bindgen-cabi.sh | ||
| #include <stdint.h> | ||
| #include <stdlib.h> | ||
| extern void *cabi_realloc_wit_bindgen_0_41_0(void *ptr, size_t old_size, size_t align, size_t new_size); | ||
| __attribute__((__weak__, __export_name__("cabi_realloc"))) | ||
| void *cabi_realloc(void *ptr, size_t old_size, size_t align, size_t new_size) { | ||
| return cabi_realloc_wit_bindgen_0_41_0(ptr, old_size, align, new_size); | ||
| } | ||
| static void *WASIP3_TASK = NULL; | ||
| __attribute__((__weak__)) | ||
| void *wasip3_task_set(void *ptr) { | ||
| void *ret = WASIP3_TASK; | ||
| WASIP3_TASK = ptr; | ||
| return ret; | ||
| } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet