diff options
author | Jasper Ras <jras@hostnet.nl> | 2025-08-08 22:44:15 +0200 |
---|---|---|
committer | Jasper Ras <jras@hostnet.nl> | 2025-08-08 22:44:15 +0200 |
commit | 22675cd8dc75d8b8d4b0f818f5b093efbc364802 (patch) | |
tree | 90156d37dccf13f012d535e7d92273259e3d5c17 /Return a static literal.md | |
parent | 295b343aecf330e830d79f06e0efc511e7d76da1 (diff) |
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 |