Skip to content

Commit 52bbcf5

Browse files
committed
Remove feature required
1 parent f949518 commit 52bbcf5

File tree

3 files changed

+4
-11
lines changed

3 files changed

+4
-11
lines changed

README.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ pub struct Group {
6161
}
6262
```
6363

64-
You can use `rename_all` and `rename` for field naming policies. All code generated by `derive(TS)` is under `#[cfg(any(test, feature="gents"))]`, so it has zero impact on your release binary.
64+
You can use `rename_all` and `rename` for field naming policies.
6565

6666
### 3. Generate TypeScript Files
6767

@@ -89,7 +89,7 @@ fn gents() {
8989

9090
### 5. Cross-Crate Usage
9191

92-
If your `TS` derives are spread across multiple crates, define a feature called `gents` in each crate and use `#[cfg(feature = "gents")]` to control code generation.
92+
If your `TS` derives are spread across multiple crates, define a feature called `gents` in each crate and use `#[cfg(feature = "gents")]` to control code generation.
9393
See [LogiSheets example](https://github.com/proclml/LogiSheets/blob/master/crates/buildtools/src/generate.rs) for advanced multi-crate setup.
9494

9595
### 6. Integration with Frontend
@@ -105,8 +105,6 @@ See [LogiSheets example](https://github.com/proclml/LogiSheets/blob/master/crate
105105
When you add a type to `FileGroup`, all of its dependencies (other structs/enums it uses) are automatically included.
106106
- **Customizing output:**
107107
You can control file names, field naming, and more via attributes.
108-
- **No runtime overhead:**
109-
All code generated by `gents` is behind `#[cfg(test)]` or `#[cfg(feature = "gents")]` and will not affect your release binary.
110108
- **Use in CI:**
111109
You can run the generation test in your CI pipeline to ensure TypeScript types are always up to date.
112110

derives/src/lib.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,6 @@ fn get_impl_block(container: Container) -> proc_macro2::TokenStream {
202202
};
203203
if container.generics.is_empty() {
204204
quote! {
205-
#[cfg(any(test, feature="gents"))]
206205
impl ::gents::TS for #ident {
207206
#register_func
208207
#ts_name_func
@@ -220,7 +219,6 @@ fn get_impl_block(container: Container) -> proc_macro2::TokenStream {
220219
.map(|g| get_generic_placeholder(&ident, g));
221220
quote! {
222221
#(#placeholder_impls)*
223-
#[cfg(any(test, feature="gents"))]
224222
impl<#(#generics_ts),*>
225223
::gents::TS for #ident<#(#generics_idents),*>{
226224
#register_func
@@ -240,11 +238,8 @@ fn get_generic_placeholder(
240238
);
241239
let ts_name = format!("{}", placeholder);
242240
quote! {
243-
#[cfg(any(test, feature="gents"))]
244241
#[derive(Clone)]
245-
#[cfg(any(test, feature="gents"))]
246242
struct #tag_ident;
247-
#[cfg(any(test, feature="gents"))]
248243
impl ::gents::TS for #tag_ident {
249244
fn _register(manager: &mut ::gents::DescriptorManager, _generic_base: bool) -> usize {
250245
let type_id = std::any::TypeId::of::<Self>();

derives/src/serde_json.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ fn get_serde_enum_impl_block(
183183
.collect::<Vec<_>>();
184184
quote! {
185185
impl<#(#generic_ser_bound),*> ::gents::serde::Serialize for #ident<#(#generics),*> {
186-
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
186+
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
187187
where S: ::gents::serde::Serializer
188188
{
189189
let dummy = match self {
@@ -195,7 +195,7 @@ fn get_serde_enum_impl_block(
195195
}
196196

197197
impl<'de, #(#generic_de_bound),*> ::gents::serde::Deserialize<'de> for #ident<#(#generics),*> {
198-
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
198+
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
199199
where D: ::gents::serde::Deserializer<'de>
200200
{
201201
let dummy = #dummy_ident::deserialize(deserializer)?;

0 commit comments

Comments
 (0)