From c5f6427b6001aa0bb260d1636641c5edf01d8998 Mon Sep 17 00:00:00 2001 From: Emerentius Date: Sun, 1 Sep 2019 11:54:15 +0200 Subject: rust: improve explanation of string slices --- rust.html.markdown | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'rust.html.markdown') diff --git a/rust.html.markdown b/rust.html.markdown index 71bc16b5..f8f6c5e4 100644 --- a/rust.html.markdown +++ b/rust.html.markdown @@ -92,10 +92,8 @@ fn main() { let s: String = "hello world".to_string(); // A string slice – an immutable view into another string - // This is basically an immutable pair of pointers to a string – it doesn’t - // actually contain the contents of a string, just a pointer to - // the begin and a pointer to the end of a string buffer, - // statically allocated or contained in another object (in this case, `s`) + // The string buffer can be statically allocated like in a string literal + // or contained in another object (in this case, `s`) let s_slice: &str = &s; println!("{} {}", s, s_slice); // hello world hello world -- cgit v1.2.3