Skip to content

Commit

Permalink
prepare release v0.9.0-alpha3
Browse files Browse the repository at this point in the history
  • Loading branch information
lenscas committed Sep 15, 2022
1 parent ca1bc7c commit f0e9630
Show file tree
Hide file tree
Showing 10 changed files with 59 additions and 58 deletions.
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ license = "MIT OR Apache-2.0"
name = "tealr"
readme = "README.md"
repository = "https://github.com/lenscas/tealr/"
version = "0.9.0-alpha2"
version = "0.9.0-alpha3"

[workspace]
members = [
Expand Down Expand Up @@ -52,7 +52,7 @@ itertools = "0.10.3"
mlua = {version = "0.8.1", optional = true, default_features = false}
rlua = {version = "0.19.2", optional = true, default_features = false}
serde = {version = "1.0.136", features = ["derive"]}
tealr_derive = {version = "0.9.0-alpha2", optional = true, path = "./tealr_derive"}
tealr_derive = {version = "0.9.0-alpha3", optional = true, path = "./tealr_derive"}

# Rlua tests
[[test]]
Expand Down Expand Up @@ -186,4 +186,5 @@ path = "examples/mlua/userdata_proxy.rs"
required-features = ["mlua"]

[package.metadata.docs.rs]
features = ["mlua", "rlua", "rlua_builtin-lua54", "mlua_lua54", "mlua_vendored", "mlua_async", "mlua_serialize", "rlua_builtin-lua"]
features = ["mlua", "rlua", "rlua_builtin-lua54", "mlua_lua54", "mlua_vendored", "mlua_async", "mlua_serialize"]
rustdoc-args = ["--cfg", "docsrs"]
8 changes: 4 additions & 4 deletions src/exported_function.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,23 +25,23 @@ type X = Vec<NamePart>;
///Contains the data needed to write down the type of a function
#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
#[cfg_attr(
all(feature = "mlua", feature = "derive"),
all(feature = "mlua", feature = "derive", not(feature = "rlua")),
derive(crate::mlu::FromToLua, crate::TypeName)
)]
#[cfg_attr(
all(feature = "rlua", feature = "derive"),
all(feature = "rlua", feature = "derive", not(feature = "mlua")),
derive(crate::rlu::FromToLua, crate::TypeName)
)]
#[cfg_attr(
all(any(feature = "rlua", feature = "mlua"), feature = "derive"),
all(any(feature = "rlua", feature = "mlua"), feature = "derive",not(all(feature = "rlua", feature = "mlua"))),
tealr(tealr_name = crate)
)]
pub struct ExportedFunction {
///Name of the function
pub name: NameContainer,
///The full signature of the function
#[cfg_attr(
all(any(feature = "rlua", feature = "mlua"), feature = "derive"),
all(any(feature = "rlua", feature = "mlua"), feature = "derive",not(all(feature = "rlua", feature = "mlua"))),
tealr(remote = X)
)]
pub signature: Cow<'static, [crate::NamePart]>,
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ mod type_walker;
pub use exported_function::ExportedFunction;
pub use teal_multivalue::{TealMultiValue, TealType};

///Implements [TypeName](tealr::TypeName).
///Implements [TypeName](crate::TypeName).
///
///`TypeName::get_type_name` will return the name of the rust type.
#[cfg(feature = "derive")]
Expand Down
10 changes: 5 additions & 5 deletions src/mlu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,18 +85,18 @@ impl<T> MaybeSend for T {}
#[cfg(feature = "derive")]
pub use tealr_derive::MluaFromToLua as FromToLua;

///Implement both [mlua::UserData](mlua::UserData) and [TypeName](tealr::TypeName).
///Implement both [mlua::UserData](mlua::UserData) and [TypeName](crate::TypeName).
///
///Look at [tealr_derive::MluaUserData](tealr_derive::MluaUserData) and [tealr_derive::TypeName](tealr_derive::TypeName)
///for more information on how the implemented traits will behave.
#[cfg(feature = "derive")]
pub use tealr_derive::MluaTealDerive as TealDerive;

///Implements [UserData](mlua::UserData) and [TypeBody](tealr::TypeBody)
///Implements [UserData](mlua::UserData) and [TypeBody](crate::TypeBody)
///
///It wraps the [mlua::UserDataMethods](mlua::UserDataMethods) into [UserDataWrapper](tealr::mlu::UserDataWrapper)
///and then passes it to `tealr::TealData::add_methods`.
///It wraps the [mlua::UserDataMethods](mlua::UserDataMethods) into [UserDataWrapper](crate::mlu::UserDataWrapper)
///and then passes it to `crate::TealData::add_methods`.
///
///Type body is implemented in a similar way, where it uses the [TealData](tealr::mlu::TealData) implementation to get the types
///Type body is implemented in a similar way, where it uses the [TealData](crate::mlu::TealData) implementation to get the types
#[cfg(feature = "derive")]
pub use tealr_derive::MluaUserData as UserData;
8 changes: 4 additions & 4 deletions src/teal_multivalue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,21 @@ use crate::{type_representation::KindOfType, NamePart, TypeName};
///Represents a type
#[derive(Debug, PartialEq, Eq, Clone, Hash, serde::Serialize, serde::Deserialize)]
#[cfg_attr(
all(feature = "mlua", feature = "derive"),
all(feature = "mlua", feature = "derive", not(feature = "rlua")),
derive(crate::mlu::FromToLua, crate::TypeName)
)]
#[cfg_attr(
all(feature = "rlua", feature = "derive"),
all(feature = "rlua", feature = "derive", not(feature = "mlua")),
derive(crate::rlu::FromToLua, crate::TypeName)
)]
#[cfg_attr(
all(any(feature = "rlua", feature = "mlua"), feature = "derive"),
all(any(feature = "rlua", feature = "mlua"), feature = "derive",not(all(feature = "rlua", feature = "mlua"))),
tealr(tealr_name = crate)
)]
pub struct TealType {
///Name of the type
#[cfg_attr(
all(any(feature = "rlua", feature = "mlua"), feature = "derive"),
all(any(feature = "rlua", feature = "mlua"), feature = "derive", not(all(feature = "rlua", feature = "mlua"))),
tealr(remote = String))]
pub name: Cow<'static, str>,
///If the type is build in, a generic or from a library
Expand Down
46 changes: 23 additions & 23 deletions src/type_generator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ use crate::rlu::{
};
#[cfg(feature = "rlua")]
use rlua::{
Context, FromLua, FromLuaMulti as FromLuaMultiR, MetaMethod as MetaMethodR, Result as ResultR,
ToLuaMulti as ToLuaMultiR, UserData as UserDataR,
Context, FromLua as FromLuaR, FromLuaMulti as FromLuaMultiR, MetaMethod as MetaMethodR,
Result as ResultR, ToLuaMulti as ToLuaMultiR, UserData as UserDataR,
};
use serde::{Deserialize, Serialize};

Expand All @@ -23,8 +23,8 @@ use crate::mlu::{
};
#[cfg(feature = "mlua")]
use mlua::{
FromLua, FromLuaMulti as FromLuaMultiM, Lua, MetaMethod as MetaMethodM, Result as ResultM,
ToLua, ToLuaMulti as ToLuaMultiM, UserData as UserDataM,
FromLua as FromLuaM, FromLuaMulti as FromLuaMultiM, Lua, MetaMethod as MetaMethodM,
Result as ResultM, ToLua as ToLuaM, ToLuaMulti as ToLuaMultiM, UserData as UserDataM,
};

use crate::{exported_function::ExportedFunction, type_parts_to_str, NamePart, TypeName};
Expand All @@ -44,7 +44,7 @@ impl Deref for NameContainer {
}
}
#[cfg(feature = "rlua")]
impl<'lua> FromLua<'lua> for NameContainer {
impl<'lua> FromLuaR<'lua> for NameContainer {
fn from_lua(lua_value: rlua::Value<'lua>, lua: Context<'lua>) -> ResultR<Self> {
Ok(String::from_lua(lua_value, lua)?.into_bytes().into())
}
Expand All @@ -63,13 +63,13 @@ impl TypeName for NameContainer {
}

#[cfg(feature = "mlua")]
impl<'lua> FromLua<'lua> for NameContainer {
impl<'lua> FromLuaM<'lua> for NameContainer {
fn from_lua(lua_value: mlua::Value<'lua>, lua: &'lua Lua) -> ResultM<Self> {
Ok(String::from_lua(lua_value, lua)?.into_bytes().into())
}
}
#[cfg(feature = "mlua")]
impl<'lua> ToLua<'lua> for NameContainer {
impl<'lua> ToLuaM<'lua> for NameContainer {
fn to_lua(self, lua: &'lua Lua) -> ResultM<mlua::Value<'lua>> {
lua.create_string(&self.0).and_then(|x| x.to_lua(lua))
}
Expand Down Expand Up @@ -116,22 +116,22 @@ pub(crate) fn get_method_data<A: TealMultiValue, R: TealMultiValue, S: ?Sized +
///Container of all the information needed to create the `.d.tl` file for your type.
#[derive(serde::Serialize, serde::Deserialize, Clone)]
#[cfg_attr(
all(feature = "mlua", feature = "derive"),
all(feature = "mlua", feature = "derive", not(feature = "rlua")),
derive(crate::mlu::FromToLua, crate::TypeName)
)]
#[cfg_attr(
all(feature = "rlua", feature = "derive"),
all(feature = "rlua", feature = "derive", not(feature = "mlua")),
derive(crate::rlu::FromToLua, crate::TypeName)
)]
#[cfg_attr(
all(any(feature = "rlua", feature = "mlua"), feature = "derive"),
all(any(feature = "rlua", feature = "mlua"), feature = "derive", not(all(feature = "mlua", feature="rlua"))),
tealr(tealr_name = crate)
)]
pub enum TypeGenerator {
///the type should be represented as a struct
Record(
#[cfg_attr(
all(any(feature = "rlua", feature = "mlua"), feature = "derive"),
all(any(feature = "rlua", feature = "mlua"), feature = "derive",not(all(feature = "rlua", feature = "mlua"))),
tealr(remote = RecordGenerator))]
Box<RecordGenerator>,
),
Expand All @@ -152,22 +152,22 @@ type V = Vec<NamePart>;
///contains all the information needed to create a teal enum.
#[derive(Clone, serde::Serialize, serde::Deserialize)]
#[cfg_attr(
all(feature = "mlua", feature = "derive"),
all(feature = "mlua", feature = "derive", not(feature = "rlua")),
derive(crate::mlu::FromToLua, crate::TypeName)
)]
#[cfg_attr(
all(feature = "rlua", feature = "derive"),
all(feature = "rlua", feature = "derive", not(feature = "mlua")),
derive(crate::rlu::FromToLua, crate::TypeName)
)]
#[cfg_attr(
all(any(feature = "rlua", feature = "mlua"), feature = "derive"),
all(any(feature = "rlua", feature = "mlua"), feature = "derive", not(all(feature = "rlua", feature = "mlua"))),
tealr(tealr_name = crate)
)]

pub struct EnumGenerator {
///the name of this enum
#[cfg_attr(
all(any(feature = "rlua", feature = "mlua"), feature = "derive"),
all(any(feature = "rlua", feature = "mlua"), feature = "derive", not(all(feature = "rlua", feature = "mlua"))),
tealr(remote = V)
)]
pub name: Cow<'static, [NamePart]>,
Expand Down Expand Up @@ -213,15 +213,15 @@ impl EnumGenerator {

#[derive(serde::Serialize, serde::Deserialize, Clone)]
#[cfg_attr(
all(feature = "mlua", feature = "derive"),
all(feature = "mlua", feature = "derive", not(feature = "rlua")),
derive(crate::mlu::FromToLua, crate::TypeName)
)]
#[cfg_attr(
all(feature = "rlua", feature = "derive"),
all(feature = "rlua", feature = "derive", not(feature = "mlua")),
derive(crate::rlu::FromToLua, crate::TypeName)
)]
#[cfg_attr(
all(any(feature = "rlua", feature = "mlua"), feature = "derive"),
all(any(feature = "rlua", feature = "mlua"), feature = "derive", not(all(feature = "rlua", feature = "mlua"))),
tealr(tealr_name = crate)
)]

Expand All @@ -232,7 +232,7 @@ pub struct Field {

///the type of the field
#[cfg_attr(
all(any(feature = "rlua", feature = "mlua"), feature = "derive"),
all(any(feature = "rlua", feature = "mlua"), feature = "derive", not(all(feature = "rlua", feature = "mlua"))),
tealr(remote = V)
)]
pub teal_type: Cow<'static, [NamePart]>,
Expand All @@ -253,15 +253,15 @@ impl From<Field> for (NameContainer, Cow<'static, [NamePart]>) {
///contains all the information needed to create a record
#[derive(Default, Clone, serde::Serialize, serde::Deserialize)]
#[cfg_attr(
all(feature = "mlua", feature = "derive"),
all(feature = "mlua", feature = "derive", not(feature = "rlua")),
derive(crate::mlu::FromToLua, crate::TypeName)
)]
#[cfg_attr(
all(feature = "rlua", feature = "derive"),
all(feature = "rlua", feature = "derive", not(feature = "mlua")),
derive(crate::rlu::FromToLua, crate::TypeName)
)]
#[cfg_attr(
all(any(feature = "rlua", feature = "mlua"), feature = "derive"),
all(any(feature = "rlua", feature = "mlua"), feature = "derive", not(all(feature = "rlua", feature = "mlua"))),
tealr(tealr_name = crate)
)]

Expand All @@ -272,7 +272,7 @@ pub struct RecordGenerator {
pub is_user_data: bool,
///The name of the type in teal
#[cfg_attr(
all(any(feature = "rlua", feature = "mlua"), feature = "derive"),
all(any(feature = "rlua", feature = "mlua"), feature = "derive", not(all(feature = "rlua", feature = "mlua"))),
tealr(remote = V)
)]
pub type_name: Cow<'static, [NamePart]>,
Expand Down
14 changes: 7 additions & 7 deletions src/type_representation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,15 @@ macro_rules! impl_type_name {
///Keeps track of any special treatment a type needs to get
#[derive(Debug, Clone, PartialEq, Eq, Hash, serde::Serialize, serde::Deserialize)]
#[cfg_attr(
all(feature = "mlua", feature = "derive"),
all(feature = "mlua", feature = "derive", not(feature = "rlua")),
derive(crate::mlu::FromToLua, crate::TypeName)
)]
#[cfg_attr(
all(feature = "rlua", feature = "derive"),
all(feature = "rlua", feature = "derive", not(feature = "mlua")),
derive(crate::rlu::FromToLua, crate::TypeName)
)]
#[cfg_attr(
all(any(feature = "rlua", feature = "mlua"), feature = "derive"),
all(any(feature = "rlua", feature = "mlua"), feature = "derive", not(all(feature = "rlua", feature = "mlua")) ),
tealr(tealr_name = crate)
)]
pub enum KindOfType {
Expand Down Expand Up @@ -136,15 +136,15 @@ macro_rules! new_type {
}
#[derive(Debug, Clone, PartialEq, Hash, Eq, serde::Serialize, serde::Deserialize)]
#[cfg_attr(
all(feature = "mlua", feature = "derive"),
all(feature = "mlua", feature = "derive", not(feature = "rlua")),
derive(crate::mlu::FromToLua, crate::TypeName)
)]
#[cfg_attr(
all(feature = "rlua", feature = "derive"),
all(feature = "rlua", feature = "derive", not(feature = "mlua")),
derive(crate::rlu::FromToLua, crate::TypeName)
)]
#[cfg_attr(
all(any(feature = "rlua", feature = "mlua"), feature = "derive"),
all(any(feature = "rlua", feature = "mlua"), feature = "derive", not(all(feature = "rlua", feature = "mlua"))),
tealr(tealr_name = crate)
)]
///The parts that a name consists of
Expand All @@ -153,7 +153,7 @@ pub enum NamePart {
///An example could be the `function(` part inside `function(integer):string`
Symbol(
#[cfg_attr(
all(any(feature = "rlua", feature = "mlua"), feature = "derive"),
all(any(feature = "rlua", feature = "mlua"), feature = "derive",not(all(feature = "rlua", feature = "mlua"))),
tealr(remote = String))]
Cow<'static, str>,
),
Expand Down
16 changes: 8 additions & 8 deletions src/type_walker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,26 @@ type V = Vec<NamePart>;
#[derive(Clone, serde::Serialize, serde::Deserialize)]
///Used to document what global instances get made by the module
#[cfg_attr(
all(feature = "mlua", feature = "derive"),
all(feature = "mlua", feature = "derive", not(feature = "rlua")),
derive(crate::mlu::FromToLua, crate::TypeName)
)]
#[cfg_attr(
all(feature = "rlua", feature = "derive"),
all(feature = "rlua", feature = "derive", not(feature = "mlua")),
derive(crate::rlu::FromToLua, crate::TypeName)
)]
#[cfg_attr(
all(any(feature = "rlua", feature = "mlua"), feature = "derive"),
all(any(feature = "rlua", feature = "mlua"), feature = "derive", not(all(feature = "rlua", feature = "mlua"))),
tealr(tealr_name = crate)
)]
pub struct GlobalInstance {
///name of the global
#[cfg_attr(
all(any(feature = "rlua", feature = "mlua"), feature = "derive"),
all(any(feature = "rlua", feature = "mlua"), feature = "derive", not(all(feature = "rlua", feature = "mlua"))),
tealr(remote = String))]
pub name: Cow<'static, str>,
///the type
#[cfg_attr(
all(any(feature = "rlua", feature = "mlua"), feature = "derive"),
all(any(feature = "rlua", feature = "mlua"), feature = "derive", not(all(feature = "rlua", feature = "mlua"))),
tealr(remote = V))]
pub teal_type: Cow<'static, [NamePart]>,
///if the type is external
Expand All @@ -38,15 +38,15 @@ pub struct GlobalInstance {
///This generates the .d.tl files
#[derive(Default, Clone, serde::Serialize, serde::Deserialize)]
#[cfg_attr(
all(feature = "mlua", feature = "derive"),
all(feature = "mlua", feature = "derive", not(feature = "rlua")),
derive(crate::mlu::FromToLua, crate::TypeName)
)]
#[cfg_attr(
all(feature = "rlua", feature = "derive"),
all(feature = "rlua", feature = "derive", not(feature = "mlua")),
derive(crate::rlu::FromToLua, crate::TypeName)
)]
#[cfg_attr(
all(any(feature = "rlua", feature = "mlua"), feature = "derive"),
all(any(feature = "rlua", feature = "mlua"), feature = "derive", not(all(feature = "rlua", feature = "mlua"))),
tealr(tealr_name = crate)
)]
pub struct TypeWalker {
Expand Down
2 changes: 1 addition & 1 deletion tealr_derive/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ keywords = ["derive", "macro", "teal", "lua", "tealr"]
license = "MIT OR Apache-2.0"
name = "tealr_derive"
repository = "https://github.com/lenscas/tealr/"
version = "0.9.0-alpha2"
version = "0.9.0-alpha3"

[features]
compile = ["tempfile"]
Expand Down

0 comments on commit f0e9630

Please sign in to comment.