Trying to declare a String const results in expected type, found "my string"

Viewed 17604

I'm trying to declare a String constant in Rust, but I get a compiler error I just can't make sense of

const DATABASE : String::from("/var/lib/tracker/tracker.json");

and here's what I get when I try to compile it:

error: expected type, found `"/var/lib/tracker/tracker.json"`
  --> src/main.rs:19:31
   |
19 | const DATABASE : String::from("/var/lib/tracker/tracker.json");
   |                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: expected one of `!`, `+`, `->`, `::`, or `=`, found `)`
  --> src/main.rs:19:64
   |
19 | const DATABASE : String::from("/var/lib/tracker/tracker.json");
   |                                                                ^ expected one of `!`, `+`, `->`, `::`, or `=` here
1 Answers
Related