@@ -19,15 +19,15 @@ use syn::{
19
19
/// For example:
20
20
///
21
21
/// ```
22
- /// #[ocaml_gen]
22
+ /// #[ocaml_gen::func ]
23
23
/// #[ocaml::func]
24
24
/// pub fn something(arg1: String) {
25
25
/// //...
26
26
/// }
27
27
/// ```
28
28
///
29
29
#[ proc_macro_attribute]
30
- pub fn ocaml_gen ( _attribute : TokenStream , item : TokenStream ) -> TokenStream {
30
+ pub fn func ( _attribute : TokenStream , item : TokenStream ) -> TokenStream {
31
31
let item_fn: syn:: ItemFn = syn:: parse ( item) . unwrap ( ) ;
32
32
33
33
let rust_name = & item_fn. sig . ident ;
@@ -94,27 +94,26 @@ pub fn ocaml_gen(_attribute: TokenStream, item: TokenStream) -> TokenStream {
94
94
}
95
95
96
96
//
97
- // OcamlEnum
97
+ // Enum
98
98
//
99
99
100
- /// The OcamlEnum derive macro.
100
+ /// The Enum derive macro.
101
101
/// It generates implementations of ToOCaml and OCamlBinding on an enum type.
102
102
/// The type must implement [ocaml::IntoValue] and [ocaml::FromValue]
103
103
/// For example:
104
104
///
105
105
/// ```
106
- /// use ocaml_gen::OcamlEnum ;
106
+ /// use ocaml_gen::Enum ;
107
107
///
108
- /// #[OcamlEnum ]
108
+ /// #[Enum ]
109
109
/// enum MyType {
110
110
/// // ...
111
111
/// }
112
112
/// ```
113
113
///
114
- #[ proc_macro_derive( OcamlEnum ) ]
114
+ #[ proc_macro_derive( Enum ) ]
115
115
pub fn derive_ocaml_enum ( item : TokenStream ) -> TokenStream {
116
- let item_enum: syn:: ItemEnum =
117
- syn:: parse ( item) . expect ( "only enum are supported with OcamlEnum" ) ;
116
+ let item_enum: syn:: ItemEnum = syn:: parse ( item) . expect ( "only enum are supported with Enum" ) ;
118
117
119
118
//
120
119
// ocaml_desc
@@ -346,27 +345,25 @@ pub fn derive_ocaml_enum(item: TokenStream) -> TokenStream {
346
345
}
347
346
348
347
//
349
- // OcamlGen
348
+ // Struct
350
349
//
351
350
352
- /// The OcamlGen derive macro.
351
+ /// The Struct derive macro.
353
352
/// It generates implementations of ToOCaml and OCamlBinding on a struct.
354
353
/// The type must implement [ocaml::IntoValue] and [ocaml::FromValue]
355
354
/// For example:
356
355
///
357
356
/// ```
358
- /// use ocaml_gen::OcamlGen;
359
- ///
360
- /// #[OcamlGen]
357
+ /// #[ocaml_gen::Struct]
361
358
/// struct MyType {
362
359
/// // ...
363
360
/// }
364
361
/// ```
365
362
///
366
- #[ proc_macro_derive( OcamlGen ) ]
363
+ #[ proc_macro_derive( Struct ) ]
367
364
pub fn derive_ocaml_gen ( item : TokenStream ) -> TokenStream {
368
365
let item_struct: syn:: ItemStruct =
369
- syn:: parse ( item) . expect ( "only structs are supported with OCamlGen " ) ;
366
+ syn:: parse ( item) . expect ( "only structs are supported with Struct " ) ;
370
367
let name = & item_struct. ident ;
371
368
let generics = & item_struct. generics . params ;
372
369
let fields = & item_struct. fields ;
@@ -624,15 +621,15 @@ pub fn derive_ocaml_gen(item: TokenStream) -> TokenStream {
624
621
/// For example:
625
622
///
626
623
/// ```
627
- /// use ocaml_gen::OCamlCustomType ;
624
+ /// use ocaml_gen::CustomType ;
628
625
///
629
- /// #[OCamlCustomType ]
626
+ /// #[CustomType ]
630
627
/// struct MyCustomType {
631
628
/// // ...
632
629
/// }
633
630
/// ```
634
631
///
635
- #[ proc_macro_derive( OCamlCustomType ) ]
632
+ #[ proc_macro_derive( CustomType ) ]
636
633
pub fn derive_ocaml_custom ( item : TokenStream ) -> TokenStream {
637
634
let item_struct: syn:: ItemStruct =
638
635
syn:: parse ( item) . expect ( "only structs are supported at the moment" ) ;
0 commit comments