Closed Geobert closed 5 years ago
My bad, my config was wrong
I was right, fixed the constant
colour, and still showing as a type ^^'
Hello @Geobert , I'm sorry for such late response, I had very busy week.
It appears, that syntax of class constants is similar to enum variants. But in certain cases they still can be distinguished based on outer context.
Am I right that constants for example can be used in expressions, as function arguments, etc. While enum variants are used mostly in match
expression or construction of variables?
I'm sorry for such late response, I had very busy week.
Don't be sorry, we all have IRL stuff to deal with ^^
In this case, the constant is not event in a class, but in a module. In Rust, each file is a module so error.rs
create the error
module. And in this module, we define a constant.
If I try to compare to C++, I think error
acts like a namespace in which we define a const.
Am I right that constants for example can be used in expressions, as function arguments, etc. While enum variants are used mostly in match expression or construction of variables?
Enum variants can also be used as function argument:
fn my_fct(arg: Option<MyType>) {
// ...
}
my_fct(Some(value_of_type_MyType));
my_fct(None);
Some(T)
and None
being variants of the Option
enum
I'll try ti investigate this. By the way, had this feature helped you with todo-tags in comments?
I haven't take the time to test it yet ^^ I'll keep you posted :)
I'm sorry, I've closed this issue by accident. I didn't know that GitHub does this automatically when you put something like fixes #17
in commit message (=.
Highlighting of consts now looks like this:
While not breaking highlighting of enums:
This fix will be included in the next version.
I have some consts defined, and they are coloured as type
example:![image](https://user-images.githubusercontent.com/72570/58750081-aaa57e00-8485-11e9-90b5-b4f43348ccce.png)
from: https://github.com/ghost-in-the-sushi/efficio-server/blob/997e203c53fc7868a84e4066aa8959bd9386c23c/src/db/sessions.rs#L24
INTERNAL_ERROR of
error:INTERNAL_ERROR
is like a typeINTERNAL_ERROR is defined here: https://github.com/ghost-in-the-sushi/efficio-server/blob/997e203c53fc7868a84e4066aa8959bd9386c23c/src/error.rs#L13