This will be an online meetup with no specific agenda, however we are happy to accept submissions for talks if any.

Anyone interested in Rust is welcomed to join. While we will have no specific agenda, attendees can discuss, speak or ask about

  • Get help or clarification on any specific topic or question
  • Speak about project or something you are working or looking to work on
  • Share any specific experience on using Rust in any of your projects
  • Discuss any book/topic/library/blog in Rust
  • Want to propose a reading group?
  • Anything Rust

Hosted by

A community of rust-lang contributors and end-users from Bangalore. We also have presence on the following telegram channels https://t.me/RustIndia https://t.me/keralars https://t.me/fpncr Twitter handle: https://twitter.com/rustlangin more

Swarnim Arun

@swarnimarun

Understanding `dyn` with an `impl`

Submitted Aug 3, 2023

I have been thinking of starting an understanding Rust series, consider this the start of it.

We will discuss dyn in the context of Rust from the most straightforward analogies from other languages to a few practical and involved examples of its real-world usage, including some discussion around the idea of types and traits in general in Rust’s type system.

And finally, discuss how and when to use dyn, say over impl. Including why you can’t use it in some places at all. Eg,

trait Getter: Sized {
    fn get_getter(&self) -> &'a dyn Getter { // error
        self
    }
}

And also discuss how you would write the above in Rust nightly.


Swarnim Arun
Rust Engineer @ DeepSource

Comments

{{ gettext('Login to leave a comment') }}

{{ gettext('Post a comment…') }}
{{ gettext('New comment') }}
{{ formTitle }}

{{ errorMsg }}

{{ gettext('No comments posted yet') }}

Hosted by

A community of rust-lang contributors and end-users from Bangalore. We also have presence on the following telegram channels https://t.me/RustIndia https://t.me/keralars https://t.me/fpncr Twitter handle: https://twitter.com/rustlangin more