diff options
Diffstat (limited to 'Return a static literal.md')
-rw-r--r-- | Return a static literal.md | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/Return a static literal.md b/Return a static literal.md new file mode 100644 index 0000000..bbf6a47 --- /dev/null +++ b/Return a static literal.md @@ -0,0 +1,8 @@ +If the data doesn't change it's possible to return a literal, which is static: +```rust +fn return() -> &'static str { + "yest" +} +``` + +not sure what benefit this offers though, we could just use a const?
\ No newline at end of file |