@@ -19,15 +19,15 @@ use syn::{
1919/// For example:
2020///
2121/// ```
22- /// #[ocaml_gen]
22+ /// #[ocaml_gen::func ]
2323/// #[ocaml::func]
2424/// pub fn something(arg1: String) {
2525/// //...
2626/// }
2727/// ```
2828///
2929#[ proc_macro_attribute]
30- pub fn ocaml_gen ( _attribute : TokenStream , item : TokenStream ) -> TokenStream {
30+ pub fn func ( _attribute : TokenStream , item : TokenStream ) -> TokenStream {
3131 let item_fn: syn:: ItemFn = syn:: parse ( item) . unwrap ( ) ;
3232
3333 let rust_name = & item_fn. sig . ident ;
@@ -94,27 +94,26 @@ pub fn ocaml_gen(_attribute: TokenStream, item: TokenStream) -> TokenStream {
9494}
9595
9696//
97- // OcamlEnum
97+ // Enum
9898//
9999
100- /// The OcamlEnum derive macro.
100+ /// The Enum derive macro.
101101/// It generates implementations of ToOCaml and OCamlBinding on an enum type.
102102/// The type must implement [ocaml::IntoValue] and [ocaml::FromValue]
103103/// For example:
104104///
105105/// ```
106- /// use ocaml_gen::OcamlEnum ;
106+ /// use ocaml_gen::Enum ;
107107///
108- /// #[OcamlEnum ]
108+ /// #[Enum ]
109109/// enum MyType {
110110/// // ...
111111/// }
112112/// ```
113113///
114- #[ proc_macro_derive( OcamlEnum ) ]
114+ #[ proc_macro_derive( Enum ) ]
115115pub 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" ) ;
118117
119118 //
120119 // ocaml_desc
@@ -346,27 +345,25 @@ pub fn derive_ocaml_enum(item: TokenStream) -> TokenStream {
346345}
347346
348347//
349- // OcamlGen
348+ // Struct
350349//
351350
352- /// The OcamlGen derive macro.
351+ /// The Struct derive macro.
353352/// It generates implementations of ToOCaml and OCamlBinding on a struct.
354353/// The type must implement [ocaml::IntoValue] and [ocaml::FromValue]
355354/// For example:
356355///
357356/// ```
358- /// use ocaml_gen::OcamlGen;
359- ///
360- /// #[OcamlGen]
357+ /// #[ocaml_gen::Struct]
361358/// struct MyType {
362359/// // ...
363360/// }
364361/// ```
365362///
366- #[ proc_macro_derive( OcamlGen ) ]
363+ #[ proc_macro_derive( Struct ) ]
367364pub fn derive_ocaml_gen ( item : TokenStream ) -> TokenStream {
368365 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 " ) ;
370367 let name = & item_struct. ident ;
371368 let generics = & item_struct. generics . params ;
372369 let fields = & item_struct. fields ;
@@ -624,15 +621,15 @@ pub fn derive_ocaml_gen(item: TokenStream) -> TokenStream {
624621/// For example:
625622///
626623/// ```
627- /// use ocaml_gen::OCamlCustomType ;
624+ /// use ocaml_gen::CustomType ;
628625///
629- /// #[OCamlCustomType ]
626+ /// #[CustomType ]
630627/// struct MyCustomType {
631628/// // ...
632629/// }
633630/// ```
634631///
635- #[ proc_macro_derive( OCamlCustomType ) ]
632+ #[ proc_macro_derive( CustomType ) ]
636633pub fn derive_ocaml_custom ( item : TokenStream ) -> TokenStream {
637634 let item_struct: syn:: ItemStruct =
638635 syn:: parse ( item) . expect ( "only structs are supported at the moment" ) ;
@@ -677,7 +674,7 @@ pub fn derive_ocaml_custom(item: TokenStream) -> TokenStream {
677674 if new_type {
678675 let ty_name = rename. unwrap_or( #ocaml_name) ;
679676 let ty_id = <Self as :: ocaml_gen:: OCamlDesc >:: unique_id( ) ;
680- env. new_custom_type ( ty_id, ty_name) ;
677+ env. new_type ( ty_id, ty_name) ;
681678 }
682679
683680 let name = <Self as :: ocaml_gen:: OCamlDesc >:: ocaml_desc( env, & [ ] ) ;
0 commit comments