Need Assistance?

support@tutorialshub.in

Borrowing, References & Slices

String Slices (&str) & Array Slices (&[T])

ADVERTISEMENT
Rust Free Lesson
5 min read
ADVERTISEMENT

A Slice is a read-only view into part of a String or Array without copying any memory. Always prefer &str over &String for function parameters—it accepts both string literals ("hello") and borrowed Strings!

ADVERTISEMENT
Hi, I'm Tuby! Here to help you