diff --git a/10_smart_pointers/smart_pointers-dark.html b/10_smart_pointers/smart_pointers-dark.html index 5bdfce5..9b59d5e 100644 --- a/10_smart_pointers/smart_pointers-dark.html +++ b/10_smart_pointers/smart_pointers-dark.html @@ -1,4 +1,4 @@ -Smart Pointers and Trait Objects

Intro to Rust Lang

Smart Pointers and Trait Objects

@@ -310,7 +310,7 @@

Deref Coercion

  • Deref Coercion converts a &Box<String> into a &String
  • Deref Coercion converts a &String into &str
      -
    • String implements the Deref trait such that Deref::Target = &str
    • +
    • String implements the Deref trait such that Deref::Target = str
  • @@ -1066,7 +1066,7 @@

    Next Lecture: Unsafe

    Connor Tsui, Benjamin Owad, David Rudo,
    Jessica Ruan, Fiona Fisher, Terrance Chen

    -

    String, for example, stores its capacity as metadata and has the extra ability to ensure its data will always be valid UTF-8.

    This should look familiar to people who have taken / are taking 15-150!

    Technically the compiler is allowed to store data of Boxes on the stack if it wants to

    The reasoning for why transferring ownership is faster is that data won't need to be copied to another stack for example, just the pointer.

    This code is copied and pasted directly from the standard library diff --git a/10_smart_pointers/smart_pointers-dark.pdf b/10_smart_pointers/smart_pointers-dark.pdf index 0739006..be87c54 100644 Binary files a/10_smart_pointers/smart_pointers-dark.pdf and b/10_smart_pointers/smart_pointers-dark.pdf differ diff --git a/10_smart_pointers/smart_pointers-light.html b/10_smart_pointers/smart_pointers-light.html index c80d112..e6b988d 100644 --- a/10_smart_pointers/smart_pointers-light.html +++ b/10_smart_pointers/smart_pointers-light.html @@ -1,4 +1,4 @@ -Smart Pointers and Trait Objects

    Intro to Rust Lang

    Smart Pointers and Trait Objects

    @@ -310,7 +310,7 @@

    Deref Coercion

  • Deref Coercion converts a &Box<String> into a &String
  • Deref Coercion converts a &String into &str
      -
    • String implements the Deref trait such that Deref::Target = &str
    • +
    • String implements the Deref trait such that Deref::Target = str
  • @@ -1066,7 +1066,7 @@

    Next Lecture: Unsafe

    Connor Tsui, Benjamin Owad, David Rudo,
    Jessica Ruan, Fiona Fisher, Terrance Chen

    -

    String, for example, stores its capacity as metadata and has the extra ability to ensure its data will always be valid UTF-8.

    This should look familiar to people who have taken / are taking 15-150!

    Technically the compiler is allowed to store data of Boxes on the stack if it wants to

    The reasoning for why transferring ownership is faster is that data won't need to be copied to another stack for example, just the pointer.

    This code is copied and pasted directly from the standard library diff --git a/10_smart_pointers/smart_pointers-light.pdf b/10_smart_pointers/smart_pointers-light.pdf index 97d6c57..a2b9d28 100644 Binary files a/10_smart_pointers/smart_pointers-light.pdf and b/10_smart_pointers/smart_pointers-light.pdf differ diff --git a/10_smart_pointers/smart_pointers.md b/10_smart_pointers/smart_pointers.md index 39501d0..44164a2 100644 --- a/10_smart_pointers/smart_pointers.md +++ b/10_smart_pointers/smart_pointers.md @@ -423,7 +423,7 @@ hello(&m); * Deref Coercion converts a `&Box` into a `&String` * Deref Coercion converts a `&String` into `&str` - * `String` implements the `Deref` trait such that `Deref::Target = &str` + * `String` implements the `Deref` trait such that `Deref::Target = str` ---