diff options
Diffstat (limited to 'crates/ra_ide/src/display')
-rw-r--r-- | crates/ra_ide/src/display/function_signature.rs | 40 |
1 files changed, 19 insertions, 21 deletions
diff --git a/crates/ra_ide/src/display/function_signature.rs b/crates/ra_ide/src/display/function_signature.rs index 709a85f65..9b7220d1f 100644 --- a/crates/ra_ide/src/display/function_signature.rs +++ b/crates/ra_ide/src/display/function_signature.rs | |||
@@ -15,49 +15,48 @@ use stdx::{split_delim, SepBy}; | |||
15 | use crate::display::{generic_parameters, where_predicates}; | 15 | use crate::display::{generic_parameters, where_predicates}; |
16 | 16 | ||
17 | #[derive(Debug)] | 17 | #[derive(Debug)] |
18 | pub enum CallableKind { | 18 | pub(crate) enum CallableKind { |
19 | Function, | 19 | Function, |
20 | StructConstructor, | 20 | StructConstructor, |
21 | VariantConstructor, | 21 | VariantConstructor, |
22 | Macro, | ||
23 | } | 22 | } |
24 | 23 | ||
25 | /// Contains information about a function signature | 24 | /// Contains information about a function signature |
26 | #[derive(Debug)] | 25 | #[derive(Debug)] |
27 | pub struct FunctionSignature { | 26 | pub(crate) struct FunctionSignature { |
28 | pub kind: CallableKind, | 27 | pub(crate) kind: CallableKind, |
29 | /// Optional visibility | 28 | /// Optional visibility |
30 | pub visibility: Option<String>, | 29 | pub(crate) visibility: Option<String>, |
31 | /// Qualifiers like `async`, `unsafe`, ... | 30 | /// Qualifiers like `async`, `unsafe`, ... |
32 | pub qualifier: FunctionQualifier, | 31 | pub(crate) qualifier: FunctionQualifier, |
33 | /// Name of the function | 32 | /// Name of the function |
34 | pub name: Option<String>, | 33 | pub(crate) name: Option<String>, |
35 | /// Documentation for the function | 34 | /// Documentation for the function |
36 | pub doc: Option<Documentation>, | 35 | pub(crate) doc: Option<Documentation>, |
37 | /// Generic parameters | 36 | /// Generic parameters |
38 | pub generic_parameters: Vec<String>, | 37 | pub(crate) generic_parameters: Vec<String>, |
39 | /// Parameters of the function | 38 | /// Parameters of the function |
40 | pub parameters: Vec<String>, | 39 | pub(crate) parameters: Vec<String>, |
41 | /// Parameter names of the function | 40 | /// Parameter names of the function |
42 | pub parameter_names: Vec<String>, | 41 | pub(crate) parameter_names: Vec<String>, |
43 | /// Parameter types of the function | 42 | /// Parameter types of the function |
44 | pub parameter_types: Vec<String>, | 43 | pub(crate) parameter_types: Vec<String>, |
45 | /// Optional return type | 44 | /// Optional return type |
46 | pub ret_type: Option<String>, | 45 | pub(crate) ret_type: Option<String>, |
47 | /// Where predicates | 46 | /// Where predicates |
48 | pub where_predicates: Vec<String>, | 47 | pub(crate) where_predicates: Vec<String>, |
49 | /// Self param presence | 48 | /// Self param presence |
50 | pub has_self_param: bool, | 49 | pub(crate) has_self_param: bool, |
51 | } | 50 | } |
52 | 51 | ||
53 | #[derive(Debug, Default)] | 52 | #[derive(Debug, Default)] |
54 | pub struct FunctionQualifier { | 53 | pub(crate) struct FunctionQualifier { |
55 | // `async` and `const` are mutually exclusive. Do we need to enforcing it here? | 54 | // `async` and `const` are mutually exclusive. Do we need to enforcing it here? |
56 | pub is_async: bool, | 55 | pub(crate) is_async: bool, |
57 | pub is_const: bool, | 56 | pub(crate) is_const: bool, |
58 | pub is_unsafe: bool, | 57 | pub(crate) is_unsafe: bool, |
59 | /// The string `extern ".."` | 58 | /// The string `extern ".."` |
60 | pub extern_abi: Option<String>, | 59 | pub(crate) extern_abi: Option<String>, |
61 | } | 60 | } |
62 | 61 | ||
63 | impl FunctionSignature { | 62 | impl FunctionSignature { |
@@ -277,7 +276,6 @@ impl Display for FunctionSignature { | |||
277 | CallableKind::Function => write!(f, "fn {}", name)?, | 276 | CallableKind::Function => write!(f, "fn {}", name)?, |
278 | CallableKind::StructConstructor => write!(f, "struct {}", name)?, | 277 | CallableKind::StructConstructor => write!(f, "struct {}", name)?, |
279 | CallableKind::VariantConstructor => write!(f, "{}", name)?, | 278 | CallableKind::VariantConstructor => write!(f, "{}", name)?, |
280 | CallableKind::Macro => write!(f, "{}!", name)?, | ||
281 | } | 279 | } |
282 | } | 280 | } |
283 | 281 | ||