From 8f9338970b9b954a940c8947e528c600d65f0acf Mon Sep 17 00:00:00 2001 From: makspll Date: Wed, 6 Nov 2024 22:49:04 +0000 Subject: [PATCH] fix more errors --- crates/bevy_script_api/Cargo.toml | 1 - .../src/providers/bevy_input.rs | 155 +++++----- .../src/providers/bevy_math.rs | 20 +- .../src/providers/bevy_reflect.rs | 290 +++++++++--------- 4 files changed, 233 insertions(+), 233 deletions(-) diff --git a/crates/bevy_script_api/Cargo.toml b/crates/bevy_script_api/Cargo.toml index 1e49c377..d4ed591f 100644 --- a/crates/bevy_script_api/Cargo.toml +++ b/crates/bevy_script_api/Cargo.toml @@ -28,7 +28,6 @@ bevy = { workspace = true, default-features = false, features = [ "bevy_sprite", "file_watcher", "multi_threaded", - "bevy_reflect", ] } uuid = "1.10" bevy_mod_scripting_core = { workspace = true } diff --git a/crates/bevy_script_api/src/providers/bevy_input.rs b/crates/bevy_script_api/src/providers/bevy_input.rs index 72d379ab..973bde55 100644 --- a/crates/bevy_script_api/src/providers/bevy_input.rs +++ b/crates/bevy_script_api/src/providers/bevy_input.rs @@ -13,21 +13,22 @@ use bevy_script_api::{ #[proxy( derive(), remote = "bevy::input::gamepad::Gamepad", - functions[r#" -/// Returns the USB vendor ID as assigned by the USB-IF, if available. + functions[ + // r#" +// /// Returns the USB vendor ID as assigned by the USB-IF, if available. - #[lua(kind = "Method")] - fn vendor_id(&self) -> std::option::Option; +// #[lua(kind = "Method")] +// fn vendor_id(&self) -> std::option::Option; -"#, - r#" -/// Returns the USB product ID as assigned by the [vendor], if available. -/// [vendor]: Self::vendor_id +// "#, +// r#" +// /// Returns the USB product ID as assigned by the [vendor], if available. +// /// [vendor]: Self::vendor_id - #[lua(kind = "Method")] - fn product_id(&self) -> std::option::Option; +// #[lua(kind = "Method")] +// fn product_id(&self) -> std::option::Option; -"#, +// "#, r#" /// Returns the left stick as a [`Vec2`] @@ -49,37 +50,37 @@ use bevy_script_api::{ fn dpad(&self) -> bevy::math::Vec2; "#, - r#" -/// Returns `true` if the [`GamepadButton`] has been pressed. +// r#" +// /// Returns `true` if the [`GamepadButton`] has been pressed. - #[lua(kind = "Method")] - fn pressed(&self, #[proxy] button_type: bevy::input::gamepad::GamepadButton) -> bool; +// #[lua(kind = "Method")] +// fn pressed(&self, #[proxy] button_type: bevy::input::gamepad::GamepadButton) -> bool; -"#, - r#" -/// Returns `true` if the [`GamepadButton`] has been pressed during the current frame. -/// Note: This function does not imply information regarding the current state of [`ButtonInput::pressed`] or [`ButtonInput::just_released`]. +// "#, +// r#" +// /// Returns `true` if the [`GamepadButton`] has been pressed during the current frame. +// /// Note: This function does not imply information regarding the current state of [`ButtonInput::pressed`] or [`ButtonInput::just_released`]. - #[lua(kind = "Method")] - fn just_pressed( - &self, - #[proxy] - button_type: bevy::input::gamepad::GamepadButton, - ) -> bool; +// #[lua(kind = "Method")] +// fn just_pressed( +// &self, +// #[proxy] +// button_type: bevy::input::gamepad::GamepadButton, +// ) -> bool; -"#, - r#" -/// Returns `true` if the [`GamepadButton`] has been released during the current frame. -/// Note: This function does not imply information regarding the current state of [`ButtonInput::pressed`] or [`ButtonInput::just_pressed`]. +// "#, +// r#" +// /// Returns `true` if the [`GamepadButton`] has been released during the current frame. +// /// Note: This function does not imply information regarding the current state of [`ButtonInput::pressed`] or [`ButtonInput::just_pressed`]. - #[lua(kind = "Method")] - fn just_released( - &self, - #[proxy] - button_type: bevy::input::gamepad::GamepadButton, - ) -> bool; +// #[lua(kind = "Method")] +// fn just_released( +// &self, +// #[proxy] +// button_type: bevy::input::gamepad::GamepadButton, +// ) -> bool; -"#, +// "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] fn index(&self) -> String { @@ -824,45 +825,45 @@ fn index(&self) -> String { "#] )] struct GamepadEvent {} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - remote = "bevy::input::gamepad::GamepadInfo", - functions[r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &gamepad::GamepadInfo) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); - -"#, - r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::input::gamepad::GamepadInfo; - -"#, - r#" -#[lua(kind="MetaMethod", metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct GamepadInfo { - name: std::string::String, - vendor_id: std::option::Option, - product_id: std::option::Option, -} +// #[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +// #[proxy( +// derive(clone), +// remote = "bevy::input::gamepad::GamepadInfo", +// functions[r#" + +// #[lua( +// as_trait = "std::cmp::PartialEq", +// kind = "MetaFunction", +// composite = "eq", +// metamethod = "Eq", +// )] +// fn eq(&self, #[proxy] other: &gamepad::GamepadInfo) -> bool; + +// "#, +// r#" + +// #[lua(as_trait = "std::cmp::Eq", kind = "Method")] +// fn assert_receiver_is_total_eq(&self) -> (); + +// "#, +// r#" + +// #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] +// fn clone(&self) -> bevy::input::gamepad::GamepadInfo; + +// "#, +// r#" +// #[lua(kind="MetaMethod", metamethod="ToString")] +// fn index(&self) -> String { +// format!("{:?}", _self) +// } +// "#] +// )] +// struct GamepadInfo { +// name: std::string::String, +// vendor_id: std::option::Option, +// product_id: std::option::Option, +// } #[derive(bevy_mod_scripting_lua_derive::LuaProxy)] #[proxy( derive(clone), @@ -1818,7 +1819,7 @@ impl bevy_mod_scripting_core::hosts::APIProvider for BevyInputAPIProvider { >, >() .process_type::() - .process_type::() + // .process_type::() .process_type::() .process_type::() .process_type::() @@ -1898,7 +1899,7 @@ impl bevy_mod_scripting_core::hosts::APIProvider for BevyInputAPIProvider { app.register_foreign_lua_type::(); app.register_foreign_lua_type::(); app.register_foreign_lua_type::(); - app.register_foreign_lua_type::(); + // app.register_foreign_lua_type::(); app.register_foreign_lua_type::(); app.register_foreign_lua_type::(); app.register_foreign_lua_type::< diff --git a/crates/bevy_script_api/src/providers/bevy_math.rs b/crates/bevy_script_api/src/providers/bevy_math.rs index e6c8fd2f..62142da4 100644 --- a/crates/bevy_script_api/src/providers/bevy_math.rs +++ b/crates/bevy_script_api/src/providers/bevy_math.rs @@ -2829,13 +2829,13 @@ struct Capsule2d { fn sagitta(&self) -> f32; "#, - r#" -/// Returns the area of this sector +// r#" +// /// Returns the area of this sector - #[lua(kind = "Method")] - fn area(&self) -> f32; +// #[lua(kind = "Method")] +// fn area(&self) -> f32; -"#, +// "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] fn index(&self) -> String { @@ -2946,13 +2946,13 @@ struct CircularSector { fn sagitta(&self) -> f32; "#, - r#" -/// Returns the area of this segment +// r#" +// /// Returns the area of this segment - #[lua(kind = "Method")] - fn area(&self) -> f32; +// #[lua(kind = "Method")] +// fn area(&self) -> f32; -"#, +// "#, r#" #[lua( diff --git a/crates/bevy_script_api/src/providers/bevy_reflect.rs b/crates/bevy_script_api/src/providers/bevy_reflect.rs index 02453c8d..6fe8ad6a 100644 --- a/crates/bevy_script_api/src/providers/bevy_reflect.rs +++ b/crates/bevy_script_api/src/providers/bevy_reflect.rs @@ -23,21 +23,21 @@ use bevy_script_api::{ fn new(v: bool) -> std::sync::atomic::AtomicBool; "#, - r#" -/// Consumes the atomic and returns the contained value. -/// This is safe because passing `self` by value guarantees that no other threads are -/// concurrently accessing the atomic data. -/// # Examples -/// ``` -/// use std::sync::atomic::AtomicBool; -/// let some_bool = AtomicBool::new(true); -/// assert_eq!(some_bool.into_inner(), true); -/// ``` - - #[lua(kind = "Method")] - fn into_inner(self) -> bool; - -"#, +// r#" +// /// Consumes the atomic and returns the contained value. +// /// This is safe because passing `self` by value guarantees that no other threads are +// /// concurrently accessing the atomic data. +// /// # Examples +// /// ``` +// /// use std::sync::atomic::AtomicBool; +// /// let some_bool = AtomicBool::new(true); +// /// assert_eq!(some_bool.into_inner(), true); +// /// ``` + +// #[lua(kind = "Method")] +// fn into_inner(self) -> bool; + +// "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] fn index(&self) -> String { @@ -62,21 +62,21 @@ struct AtomicBool {} fn new(v: i16) -> std::sync::atomic::AtomicI16; "#, - r#" -/// Consumes the atomic and returns the contained value. -/// This is safe because passing `self` by value guarantees that no other threads are -/// concurrently accessing the atomic data. -/// # Examples -/// ``` -///use std::sync::atomic::AtomicI16; -///let some_var = AtomicI16::new(5); -/// assert_eq!(some_var.into_inner(), 5); -/// ``` +// r#" +// /// Consumes the atomic and returns the contained value. +// /// This is safe because passing `self` by value guarantees that no other threads are +// /// concurrently accessing the atomic data. +// /// # Examples +// /// ``` +// ///use std::sync::atomic::AtomicI16; +// ///let some_var = AtomicI16::new(5); +// /// assert_eq!(some_var.into_inner(), 5); +// /// ``` - #[lua(kind = "Method")] - fn into_inner(self) -> i16; +// #[lua(kind = "Method")] +// fn into_inner(self) -> i16; -"#, +// "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] fn index(&self) -> String { @@ -101,21 +101,21 @@ struct AtomicI16 {} fn new(v: i32) -> std::sync::atomic::AtomicI32; "#, - r#" -/// Consumes the atomic and returns the contained value. -/// This is safe because passing `self` by value guarantees that no other threads are -/// concurrently accessing the atomic data. -/// # Examples -/// ``` -///use std::sync::atomic::AtomicI32; -///let some_var = AtomicI32::new(5); -/// assert_eq!(some_var.into_inner(), 5); -/// ``` +// r#" +// /// Consumes the atomic and returns the contained value. +// /// This is safe because passing `self` by value guarantees that no other threads are +// /// concurrently accessing the atomic data. +// /// # Examples +// /// ``` +// ///use std::sync::atomic::AtomicI32; +// ///let some_var = AtomicI32::new(5); +// /// assert_eq!(some_var.into_inner(), 5); +// /// ``` - #[lua(kind = "Method")] - fn into_inner(self) -> i32; +// #[lua(kind = "Method")] +// fn into_inner(self) -> i32; -"#, +// "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] fn index(&self) -> String { @@ -140,21 +140,21 @@ struct AtomicI32 {} fn new(v: i64) -> std::sync::atomic::AtomicI64; "#, - r#" -/// Consumes the atomic and returns the contained value. -/// This is safe because passing `self` by value guarantees that no other threads are -/// concurrently accessing the atomic data. -/// # Examples -/// ``` -///use std::sync::atomic::AtomicI64; -///let some_var = AtomicI64::new(5); -/// assert_eq!(some_var.into_inner(), 5); -/// ``` +// r#" +// /// Consumes the atomic and returns the contained value. +// /// This is safe because passing `self` by value guarantees that no other threads are +// /// concurrently accessing the atomic data. +// /// # Examples +// /// ``` +// ///use std::sync::atomic::AtomicI64; +// ///let some_var = AtomicI64::new(5); +// /// assert_eq!(some_var.into_inner(), 5); +// /// ``` - #[lua(kind = "Method")] - fn into_inner(self) -> i64; +// #[lua(kind = "Method")] +// fn into_inner(self) -> i64; -"#, +// "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] fn index(&self) -> String { @@ -179,21 +179,21 @@ struct AtomicI64 {} fn new(v: i8) -> std::sync::atomic::AtomicI8; "#, - r#" -/// Consumes the atomic and returns the contained value. -/// This is safe because passing `self` by value guarantees that no other threads are -/// concurrently accessing the atomic data. -/// # Examples -/// ``` -///use std::sync::atomic::AtomicI8; -///let some_var = AtomicI8::new(5); -/// assert_eq!(some_var.into_inner(), 5); -/// ``` +// r#" +// /// Consumes the atomic and returns the contained value. +// /// This is safe because passing `self` by value guarantees that no other threads are +// /// concurrently accessing the atomic data. +// /// # Examples +// /// ``` +// ///use std::sync::atomic::AtomicI8; +// ///let some_var = AtomicI8::new(5); +// /// assert_eq!(some_var.into_inner(), 5); +// /// ``` - #[lua(kind = "Method")] - fn into_inner(self) -> i8; +// #[lua(kind = "Method")] +// fn into_inner(self) -> i8; -"#, +// "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] fn index(&self) -> String { @@ -218,21 +218,21 @@ struct AtomicI8 {} fn new(v: isize) -> std::sync::atomic::AtomicIsize; "#, - r#" -/// Consumes the atomic and returns the contained value. -/// This is safe because passing `self` by value guarantees that no other threads are -/// concurrently accessing the atomic data. -/// # Examples -/// ``` -///use std::sync::atomic::AtomicIsize; -///let some_var = AtomicIsize::new(5); -/// assert_eq!(some_var.into_inner(), 5); -/// ``` +// r#" +// /// Consumes the atomic and returns the contained value. +// /// This is safe because passing `self` by value guarantees that no other threads are +// /// concurrently accessing the atomic data. +// /// # Examples +// /// ``` +// ///use std::sync::atomic::AtomicIsize; +// ///let some_var = AtomicIsize::new(5); +// /// assert_eq!(some_var.into_inner(), 5); +// /// ``` - #[lua(kind = "Method")] - fn into_inner(self) -> isize; +// #[lua(kind = "Method")] +// fn into_inner(self) -> isize; -"#, +// "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] fn index(&self) -> String { @@ -257,21 +257,21 @@ struct AtomicIsize {} fn new(v: u16) -> std::sync::atomic::AtomicU16; "#, - r#" -/// Consumes the atomic and returns the contained value. -/// This is safe because passing `self` by value guarantees that no other threads are -/// concurrently accessing the atomic data. -/// # Examples -/// ``` -///use std::sync::atomic::AtomicU16; -///let some_var = AtomicU16::new(5); -/// assert_eq!(some_var.into_inner(), 5); -/// ``` +// r#" +// /// Consumes the atomic and returns the contained value. +// /// This is safe because passing `self` by value guarantees that no other threads are +// /// concurrently accessing the atomic data. +// /// # Examples +// /// ``` +// ///use std::sync::atomic::AtomicU16; +// ///let some_var = AtomicU16::new(5); +// /// assert_eq!(some_var.into_inner(), 5); +// /// ``` - #[lua(kind = "Method")] - fn into_inner(self) -> u16; +// #[lua(kind = "Method")] +// fn into_inner(self) -> u16; -"#, +// "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] fn index(&self) -> String { @@ -296,21 +296,21 @@ struct AtomicU16 {} fn new(v: u32) -> std::sync::atomic::AtomicU32; "#, - r#" -/// Consumes the atomic and returns the contained value. -/// This is safe because passing `self` by value guarantees that no other threads are -/// concurrently accessing the atomic data. -/// # Examples -/// ``` -///use std::sync::atomic::AtomicU32; -///let some_var = AtomicU32::new(5); -/// assert_eq!(some_var.into_inner(), 5); -/// ``` +// r#" +// /// Consumes the atomic and returns the contained value. +// /// This is safe because passing `self` by value guarantees that no other threads are +// /// concurrently accessing the atomic data. +// /// # Examples +// /// ``` +// ///use std::sync::atomic::AtomicU32; +// ///let some_var = AtomicU32::new(5); +// /// assert_eq!(some_var.into_inner(), 5); +// /// ``` - #[lua(kind = "Method")] - fn into_inner(self) -> u32; +// #[lua(kind = "Method")] +// fn into_inner(self) -> u32; -"#, +// "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] fn index(&self) -> String { @@ -335,21 +335,21 @@ struct AtomicU32 {} fn new(v: u64) -> std::sync::atomic::AtomicU64; "#, - r#" -/// Consumes the atomic and returns the contained value. -/// This is safe because passing `self` by value guarantees that no other threads are -/// concurrently accessing the atomic data. -/// # Examples -/// ``` -///use std::sync::atomic::AtomicU64; -///let some_var = AtomicU64::new(5); -/// assert_eq!(some_var.into_inner(), 5); -/// ``` +// r#" +// /// Consumes the atomic and returns the contained value. +// /// This is safe because passing `self` by value guarantees that no other threads are +// /// concurrently accessing the atomic data. +// /// # Examples +// /// ``` +// ///use std::sync::atomic::AtomicU64; +// ///let some_var = AtomicU64::new(5); +// /// assert_eq!(some_var.into_inner(), 5); +// /// ``` - #[lua(kind = "Method")] - fn into_inner(self) -> u64; +// #[lua(kind = "Method")] +// fn into_inner(self) -> u64; -"#, +// "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] fn index(&self) -> String { @@ -374,21 +374,21 @@ struct AtomicU64 {} fn new(v: u8) -> std::sync::atomic::AtomicU8; "#, - r#" -/// Consumes the atomic and returns the contained value. -/// This is safe because passing `self` by value guarantees that no other threads are -/// concurrently accessing the atomic data. -/// # Examples -/// ``` -///use std::sync::atomic::AtomicU8; -///let some_var = AtomicU8::new(5); -/// assert_eq!(some_var.into_inner(), 5); -/// ``` +// r#" +// /// Consumes the atomic and returns the contained value. +// /// This is safe because passing `self` by value guarantees that no other threads are +// /// concurrently accessing the atomic data. +// /// # Examples +// /// ``` +// ///use std::sync::atomic::AtomicU8; +// ///let some_var = AtomicU8::new(5); +// /// assert_eq!(some_var.into_inner(), 5); +// /// ``` - #[lua(kind = "Method")] - fn into_inner(self) -> u8; +// #[lua(kind = "Method")] +// fn into_inner(self) -> u8; -"#, +// "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] fn index(&self) -> String { @@ -413,21 +413,21 @@ struct AtomicU8 {} fn new(v: usize) -> std::sync::atomic::AtomicUsize; "#, - r#" -/// Consumes the atomic and returns the contained value. -/// This is safe because passing `self` by value guarantees that no other threads are -/// concurrently accessing the atomic data. -/// # Examples -/// ``` -///use std::sync::atomic::AtomicUsize; -///let some_var = AtomicUsize::new(5); -/// assert_eq!(some_var.into_inner(), 5); -/// ``` +// r#" +// /// Consumes the atomic and returns the contained value. +// /// This is safe because passing `self` by value guarantees that no other threads are +// /// concurrently accessing the atomic data. +// /// # Examples +// /// ``` +// ///use std::sync::atomic::AtomicUsize; +// ///let some_var = AtomicUsize::new(5); +// /// assert_eq!(some_var.into_inner(), 5); +// /// ``` - #[lua(kind = "Method")] - fn into_inner(self) -> usize; +// #[lua(kind = "Method")] +// fn into_inner(self) -> usize; -"#, +// "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] fn index(&self) -> String {