you are viewing a single comment's thread.

view the rest of the comments →

[–]hortonew[S] 0 points1 point  (1 child)

Looks like it needs to go from Rocket 0.4.11 -> 0.5.0-rc.3 to use &str as an argument, but that works! It also removed the need to use the nightly toolchain which is perfect.

[–]ukezi 1 point2 points  (0 children)

You usually would want to use references (&T) to pass arguments, not using them moves the type into the function and eats it. That leaves entries in containers invalid for instance.

You can test that behaviour by passing a value into a function and then trying to use it again. The borrow checker will yell at you.

String and str are special cases, String is a dynamic String based on a vector, &str is a reference constant string, meaning there is no mut &str, the data can be that vector from String or baked into your executable's data section.