SaveSnippets
Community
Pricing
Sign In
Get Started
Community
Public Snippets
1
Code shared by the SaveSnippets community — browse, copy, and get inspired.
All Languages
Bash
Go
HTML
Java
JavaScript
Kotlin
PHP
Python
Rust
SQL
TypeScript
#str
Clear
Tags
#php
#kotlin
#bash
#go
#sql
#rust
#typescript
#html
#java
#python
#files
#utils
#strings
#http
#concurrency
#async
#json
#arrays
#security
#types
#crypto
#database
#dates
#format
Rust
String vs &str — The Cheat Sheet
`String` is an owned, growable heap allocation; `&str` is a borrowed view into a UTF-8 buffer. Function params should usually take `&str`; return types use `String` when ownership is needed.
#rust
#strings
#str
#string