forked from bytecodealliance/wit-bindgen
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
144 additions
and
151 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -807,8 +807,19 @@ pub mod symmetric { | |
} | ||
impl StreamObj { | ||
#[allow(unused_unsafe, clippy::all)] | ||
pub fn read_result(&self) -> Buffer { | ||
/// none is EOF | ||
pub fn read_result(&self) -> Option<Buffer> { | ||
unsafe { | ||
#[cfg_attr(target_pointer_width = "64", repr(align(8)))] | ||
#[cfg_attr(target_pointer_width = "32", repr(align(4)))] | ||
struct RetArea( | ||
[::core::mem::MaybeUninit<u8>; 2 * core::mem::size_of::<*const u8>()], | ||
); | ||
let mut ret_area = RetArea( | ||
[::core::mem::MaybeUninit::uninit(); | ||
2 * core::mem::size_of::<*const u8>()], | ||
); | ||
let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>(); | ||
#[link(wasm_import_module = "symmetric:runtime/[email protected]")] | ||
extern "C" { | ||
#[cfg_attr( | ||
|
@@ -817,10 +828,25 @@ pub mod symmetric { | |
)] | ||
fn symmetricX3AruntimeX2Fsymmetric_streamX400X2E1X2E0X00X5BmethodX5Dstream_objX2Eread_result( | ||
_: *mut u8, | ||
) -> *mut u8; | ||
_: *mut u8, | ||
); | ||
} | ||
symmetricX3AruntimeX2Fsymmetric_streamX400X2E1X2E0X00X5BmethodX5Dstream_objX2Eread_result((self).handle() as *mut u8, ptr0); | ||
let l1 = i32::from(*ptr0.add(0).cast::<u8>()); | ||
match l1 { | ||
0 => None, | ||
1 => { | ||
let e = { | ||
let l2 = *ptr0 | ||
.add(core::mem::size_of::<*const u8>()) | ||
.cast::<*mut u8>(); | ||
|
||
Buffer::from_handle(l2 as usize) | ||
}; | ||
Some(e) | ||
} | ||
_ => _rt::invalid_enum_discriminant(), | ||
} | ||
let ret = symmetricX3AruntimeX2Fsymmetric_streamX400X2E1X2E0X00X5BmethodX5Dstream_objX2Eread_result((self).handle() as *mut u8); | ||
Buffer::from_handle(ret as usize) | ||
} | ||
} | ||
} | ||
|
@@ -884,8 +910,13 @@ pub mod symmetric { | |
} | ||
impl StreamObj { | ||
#[allow(unused_unsafe, clippy::all)] | ||
pub fn finish_writing(&self, buffer: Buffer) -> () { | ||
/// none is EOF | ||
pub fn finish_writing(&self, buffer: Option<Buffer>) -> () { | ||
unsafe { | ||
let (result0_0, result0_1) = match &buffer { | ||
Some(e) => (1i32, (e).take_handle() as *mut u8), | ||
None => (0i32, core::ptr::null_mut()), | ||
}; | ||
#[link(wasm_import_module = "symmetric:runtime/[email protected]")] | ||
extern "C" { | ||
#[cfg_attr( | ||
|
@@ -894,10 +925,11 @@ pub mod symmetric { | |
)] | ||
fn symmetricX3AruntimeX2Fsymmetric_streamX400X2E1X2E0X00X5BmethodX5Dstream_objX2Efinish_writing( | ||
_: *mut u8, | ||
_: i32, | ||
_: *mut u8, | ||
); | ||
} | ||
symmetricX3AruntimeX2Fsymmetric_streamX400X2E1X2E0X00X5BmethodX5Dstream_objX2Efinish_writing((self).handle() as *mut u8, (&buffer).take_handle() as *mut u8); | ||
symmetricX3AruntimeX2Fsymmetric_streamX400X2E1X2E0X00X5BmethodX5Dstream_objX2Efinish_writing((self).handle() as *mut u8, result0_0, result0_1); | ||
} | ||
} | ||
} | ||
|
@@ -919,36 +951,6 @@ pub mod symmetric { | |
} | ||
} | ||
} | ||
#[allow(unused_unsafe, clippy::all)] | ||
/// special EOF buffer value (should be opaque) | ||
pub fn end_of_file() -> Buffer { | ||
unsafe { | ||
#[link(wasm_import_module = "symmetric:runtime/[email protected]")] | ||
extern "C" { | ||
#[cfg_attr(target_arch = "wasm32", link_name = "end-of-file")] | ||
fn symmetricX3AruntimeX2Fsymmetric_streamX400X2E1X2E0X00end_of_file( | ||
) -> *mut u8; | ||
} | ||
let ret = symmetricX3AruntimeX2Fsymmetric_streamX400X2E1X2E0X00end_of_file(); | ||
Buffer::from_handle(ret as usize) | ||
} | ||
} | ||
#[allow(unused_unsafe, clippy::all)] | ||
pub fn is_end_of_file(obj: &Buffer) -> bool { | ||
unsafe { | ||
#[link(wasm_import_module = "symmetric:runtime/[email protected]")] | ||
extern "C" { | ||
#[cfg_attr(target_arch = "wasm32", link_name = "is-end-of-file")] | ||
fn symmetricX3AruntimeX2Fsymmetric_streamX400X2E1X2E0X00is_end_of_file( | ||
_: *mut u8, | ||
) -> i32; | ||
} | ||
let ret = symmetricX3AruntimeX2Fsymmetric_streamX400X2E1X2E0X00is_end_of_file( | ||
(obj).handle() as *mut u8, | ||
); | ||
_rt::bool_lift(ret as u8) | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
@@ -1088,14 +1090,21 @@ mod _rt { | |
self as i64 | ||
} | ||
} | ||
pub unsafe fn invalid_enum_discriminant<T>() -> T { | ||
if cfg!(debug_assertions) { | ||
panic!("invalid enum discriminant") | ||
} else { | ||
core::hint::unreachable_unchecked() | ||
} | ||
} | ||
} | ||
|
||
#[cfg(target_arch = "wasm32")] | ||
#[unsafe(link_section = "component-type:wit-bindgen:0.37.0:symmetric:[email protected]:module:encoded world")] | ||
#[doc(hidden)] | ||
#[allow(clippy::octal_escapes)] | ||
pub static __WIT_BINDGEN_COMPONENT_TYPE: [u8; 1733] = *b"\ | ||
\0asm\x0d\0\x01\0\0\x19\x16wit-component-encoding\x04\0\x07\xc8\x0c\x01A\x02\x01\ | ||
pub static __WIT_BINDGEN_COMPONENT_TYPE: [u8; 1716] = *b"\ | ||
\0asm\x0d\0\x01\0\0\x19\x16wit-component-encoding\x04\0\x07\xb7\x0c\x01A\x02\x01\ | ||
A\x05\x01B\x20\x04\0\x11callback-function\x03\x01\x04\0\x0dcallback-data\x03\x01\ | ||
\x04\0\x12event-subscription\x03\x01\x04\0\x0fevent-generator\x03\x01\x01m\x02\x07\ | ||
started\x0bnot-started\x04\0\x0bcall-status\x03\0\x04\x01m\x02\x07pending\x05rea\ | ||
|
@@ -1109,7 +1118,7 @@ od]event-generator.subscribe\x01\x11\x01@\x01\x04self\x10\x01\0\x04\0\x20[method | |
]event-generator.activate\x01\x12\x01@\0\x01\0\x04\0\x03run\x01\x13\x01i\0\x01i\x01\ | ||
\x01@\x03\x07trigger\x0a\x08callback\x14\x04data\x15\x01\0\x04\0\x08register\x01\ | ||
\x16\x03\0*symmetric:runtime/[email protected]\x05\0\x02\x03\0\0\x12event\ | ||
-subscription\x01B+\x02\x03\x02\x01\x01\x04\0\x12event-subscription\x03\0\0\x04\0\ | ||
-subscription\x01B*\x02\x03\x02\x01\x01\x04\0\x12event-subscription\x03\0\0\x04\0\ | ||
\x07address\x03\x01\x04\0\x06buffer\x03\x01\x04\0\x0astream-obj\x03\x01\x01i\x02\ | ||
\x01i\x03\x01@\x02\x04addr\x05\x08capacityw\0\x06\x04\0\x13[constructor]buffer\x01\ | ||
\x07\x01h\x03\x01@\x01\x04self\x08\0\x05\x04\0\x1a[method]buffer.get-address\x01\ | ||
|
@@ -1121,15 +1130,15 @@ d]buffer.capacity\x01\x0a\x01i\x04\x01@\0\0\x0c\x04\0\x17[constructor]stream-obj | |
\x01@\x02\x04self\x0e\x06buffer\x06\x01\0\x04\0\x20[method]stream-obj.start-read\ | ||
ing\x01\x11\x01@\x01\x04self\x0e\x01\0\x04\0'[method]stream-obj.write-ready-acti\ | ||
vate\x01\x12\x01i\x01\x01@\x01\x04self\x0e\0\x13\x04\0'[method]stream-obj.read-r\ | ||
eady-subscribe\x01\x14\x01@\x01\x04self\x0e\0\x06\x04\0\x1e[method]stream-obj.re\ | ||
ad-result\x01\x15\x04\0$[method]stream-obj.is-ready-to-write\x01\x10\x04\0([meth\ | ||
od]stream-obj.write-ready-subscribe\x01\x14\x04\0\x20[method]stream-obj.start-wr\ | ||
iting\x01\x15\x04\0![method]stream-obj.finish-writing\x01\x11\x04\0&[method]stre\ | ||
am-obj.read-ready-activate\x01\x12\x01@\0\0\x06\x04\0\x0bend-of-file\x01\x16\x01\ | ||
@\x01\x03obj\x08\0\x7f\x04\0\x0eis-end-of-file\x01\x17\x03\0(symmetric:runtime/s\ | ||
[email protected]\x05\x02\x04\0\x1esymmetric:runtime/[email protected]\x04\0\x0b\x0c\ | ||
\x01\0\x06module\x03\0\0\0G\x09producers\x01\x0cprocessed-by\x02\x0dwit-componen\ | ||
t\x070.223.0\x10wit-bindgen-rust\x060.37.0"; | ||
eady-subscribe\x01\x14\x01k\x06\x01@\x01\x04self\x0e\0\x15\x04\0\x1e[method]stre\ | ||
am-obj.read-result\x01\x16\x04\0$[method]stream-obj.is-ready-to-write\x01\x10\x04\ | ||
\0([method]stream-obj.write-ready-subscribe\x01\x14\x01@\x01\x04self\x0e\0\x06\x04\ | ||
\0\x20[method]stream-obj.start-writing\x01\x17\x01@\x02\x04self\x0e\x06buffer\x15\ | ||
\x01\0\x04\0![method]stream-obj.finish-writing\x01\x18\x04\0&[method]stream-obj.\ | ||
read-ready-activate\x01\x12\x03\0(symmetric:runtime/[email protected]\x05\x02\ | ||
\x04\0\x1esymmetric:runtime/[email protected]\x04\0\x0b\x0c\x01\0\x06module\x03\0\0\0\ | ||
G\x09producers\x01\x0cprocessed-by\x02\x0dwit-component\x070.223.0\x10wit-bindge\ | ||
n-rust\x060.37.0"; | ||
|
||
#[inline(never)] | ||
#[doc(hidden)] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.