@@ -12,6 +12,7 @@ use self::{python::PythonFunction, ruby::RubyFunction, rust::RustFunction, umpl:
12
12
#[ cfg( feature = "unstable" ) ]
13
13
use go:: GoFunction ;
14
14
#[ derive( Debug , Clone , Copy , PartialEq , Eq , Hash ) ]
15
+ /// an enum representing the different languages that are supported
15
16
pub enum Language {
16
17
/// The python language
17
18
Python ,
@@ -31,6 +32,7 @@ pub enum Language {
31
32
All ,
32
33
}
33
34
#[ derive( Debug , Clone , PartialEq , Eq ) ]
35
+ /// the different filters that can be used to filter the functions for different languages
34
36
pub enum LanguageFilter {
35
37
/// python filter
36
38
Python ( python:: PythonFilter ) ,
@@ -195,6 +197,8 @@ pub trait FileTrait: fmt::Debug + fmt::Display {
195
197
fn filter_by ( & self , filter : & Filter ) -> Result < Self , String >
196
198
where
197
199
Self : Sized ;
200
+
201
+ /// returns the current function that the file is on
198
202
fn get_current ( & self ) -> Option < Box < dyn FunctionTrait > > ;
199
203
}
200
204
@@ -230,14 +234,17 @@ fn get_from_index(index: &HashMap<usize, Vec<usize>>, char: usize) -> Option<usi
230
234
231
235
// macro that generates the code for the different languages
232
236
macro_rules! make_file {
233
- ( $name: ident, $function: ident, $filtername: ident) => {
237
+ ( @gen $name: ident, $function: ident, $doc: expr) => {
238
+ #[ doc = $doc]
234
239
#[ derive( Debug , Clone ) ]
235
240
pub struct $name {
236
241
file_name: String ,
237
242
functions: Vec <$function>,
238
243
current_pos: usize ,
239
244
}
240
-
245
+ } ;
246
+ ( $name: ident, $function: ident, $filtername: ident) => {
247
+ make_file!( @gen $name, $function, concat!( " a way to hold a bunch of " , stringify!( $filtername) , " functions in a file" ) ) ;
241
248
impl fmt:: Display for $name {
242
249
fn fmt( & self , f: & mut fmt:: Formatter <' _>) -> fmt:: Result {
243
250
let mut file: Vec <( String , usize ) > = Vec :: new( ) ;
@@ -323,7 +330,6 @@ macro_rules! make_file {
323
330
}
324
331
} ;
325
332
}
326
-
327
333
make_file ! ( PythonFile , PythonFunction , Python ) ;
328
334
make_file ! ( RustFile , RustFunction , Rust ) ;
329
335
// #[cfg(feature = "c_lang")]
0 commit comments