-
-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Design & Write language agnostic bindings format #247
Milestone
Comments
3 tasks
So far given: #[derive(Reflect)]
/// I am a struct
struct StructType<T> {
/// hello from field
field: usize,
/// hello from field 2
field2: T,
}
#[derive(Reflect)]
/// I am a unit test type
struct UnitType;
#[derive(Reflect)]
/// I am a tuple test type
struct TupleStructType(pub usize, #[doc = "hello"] pub String);
#[derive(Reflect)]
enum EnumType {
/// hello from variant
Unit,
/// hello from variant 2
Struct {
/// hello from field
field: usize,
},
/// hello from variant 3
TupleStruct(usize, #[doc = "asd"] String),
} I have: {
"version": "0.1.0",
"types": {
"bevy_mod_scripting_core::docgen::ladfile::test::EnumType": {
"identifier": "EnumType",
"crate": "bevy_mod_scripting_core",
"path": "bevy_mod_scripting_core::docgen::ladfile::test::EnumType",
"layout": [
{
"kind": "Unit",
"name": "Unit"
},
{
"kind": "Struct",
"name": "Struct",
"fields": [
{
"name": "field",
"type": "usize"
}
]
},
{
"kind": "TupleStruct",
"name": "TupleStruct",
"fields": [
{
"type": "usize"
},
{
"type": "alloc::string::String"
}
]
}
]
},
"bevy_mod_scripting_core::docgen::ladfile::test::StructType<usize>": {
"identifier": "StructType",
"crate": "bevy_mod_scripting_core",
"path": "bevy_mod_scripting_core::docgen::ladfile::test::StructType<usize>",
"generics": [
{
"type_id": "usize",
"name": "T"
}
],
"documentation": " I am a struct",
"layout": {
"kind": "Struct",
"name": "StructType",
"fields": [
{
"name": "field",
"type": "usize"
},
{
"name": "field2",
"type": "usize"
}
]
}
},
"bevy_mod_scripting_core::docgen::ladfile::test::TupleStructType": {
"identifier": "TupleStructType",
"crate": "bevy_mod_scripting_core",
"path": "bevy_mod_scripting_core::docgen::ladfile::test::TupleStructType",
"documentation": " I am a tuple test type",
"layout": {
"kind": "TupleStruct",
"name": "TupleStructType",
"fields": [
{
"type": "usize"
},
{
"type": "alloc::string::String"
}
]
}
},
"bevy_mod_scripting_core::docgen::ladfile::test::UnitType": {
"identifier": "UnitType",
"crate": "bevy_mod_scripting_core",
"path": "bevy_mod_scripting_core::docgen::ladfile::test::UnitType",
"documentation": " I am a unit test type",
"layout": {
"kind": "Struct",
"name": "UnitType"
}
}
},
"functions": {
"::hello_world": {
"identifier": "hello_world",
"arguments": [
{
"kind": {
"primitive": "usize"
},
"name": "arg1"
}
],
"return_type": "usize"
},
"bevy_mod_scripting_core::docgen::ladfile::test::StructType<usize>::hello_world": {
"identifier": "hello_world",
"arguments": [
{
"kind": {
"primitive": "reflectReference"
},
"name": "ref_"
},
{
"kind": {
"tuple": [
{
"primitive": "usize"
},
{
"primitive": "string"
}
]
},
"name": "tuple"
},
{
"kind": {
"option": {
"vec": {
"ref": "bevy_mod_scripting_core::docgen::ladfile::test::EnumType"
}
}
},
"name": "option_vec_ref_wrapper"
}
],
"return_type": "usize"
}
},
"primitives": {
"TypeId(0x0b36ea25c1cf517efce182c726ea2190)": {
"kind": "pathBuf",
"documentation": "A heap allocated file path"
},
"TypeId(0x1c306727557831f62320b5841ddc7eb3)": {
"kind": "dynamicFunction",
"documentation": "A callable dynamic function"
},
"TypeId(0x7adbf8cf2ed263727e95f06e821c8654)": {
"kind": "osString",
"documentation": "A heap allocated OS string"
},
"TypeId(0x7f945ad2d333d63863e3b6f35dfc0c5d)": {
"kind": "dynamicFunctionMut",
"documentation": "A stateful and callable dynamic function"
},
"TypeId(0xb98b1b7157a6417863eb502cd6cb5d6d)": {
"kind": "str",
"documentation": "A static string slice"
},
"alloc::string::String": {
"kind": "string",
"documentation": "A heap allocated string"
},
"bevy_mod_scripting_core::bindings::function::script_function::FunctionCallContext": {
"kind": "functionCallContext",
"documentation": "Function call context, if accepted by a function, means the function can access the world in arbitrary ways."
},
"bevy_mod_scripting_core::bindings::reference::ReflectReference": {
"kind": "reflectReference",
"documentation": "A reference to a reflectable type"
},
"bool": {
"kind": "bool",
"documentation": "A boolean value"
},
"char": {
"kind": "char",
"documentation": "An 8-bit character"
},
"f32": {
"kind": "f32",
"documentation": "A 32-bit floating point number"
},
"f64": {
"kind": "f64",
"documentation": "A 64-bit floating point number"
},
"i128": {
"kind": "i128",
"documentation": "A signed 128-bit integer"
},
"i16": {
"kind": "i16",
"documentation": "A signed 16-bit integer"
},
"i32": {
"kind": "i32",
"documentation": "A signed 32-bit integer"
},
"i64": {
"kind": "i64",
"documentation": "A signed 64-bit integer"
},
"i8": {
"kind": "i8",
"documentation": "A signed 8-bit integer"
},
"isize": {
"kind": "isize",
"documentation": "A signed pointer-sized integer"
},
"u128": {
"kind": "u128",
"documentation": "An unsigned 128-bit integer"
},
"u16": {
"kind": "u16",
"documentation": "An unsigned 16-bit integer"
},
"u32": {
"kind": "u32",
"documentation": "An unsigned 32-bit integer"
},
"u64": {
"kind": "u64",
"documentation": "An unsigned 64-bit integer"
},
"u8": {
"kind": "u8",
"documentation": "An unsigned 8-bit integer"
},
"usize": {
"kind": "usize",
"documentation": "An unsigned pointer-sized integer"
}
}
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Given metadata and information about types functions and arguments, we should be able to produce "bindings" definition files, let's call them
language agnostic definition
files or LAD's.These should contain everything we might need for generating:
I am imagining something along the lines of:
The text was updated successfully, but these errors were encountered: