283
The meaning of this (lemmy.world)
submitted 4 days ago by [email protected] to c/[email protected]
you are viewing a single comment's thread
view the rest of the comments
[-] [email protected] 8 points 3 days ago

Rust: do you mean Self or self?

[-] [email protected] 6 points 3 days ago* (last edited 3 days ago)

this is commonly used with a similar meaning to self in cases where self can't be used because it is a reserved keyword.

Example:

    fn poll_next(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<St1::Item>> {
        let this = self.project();
        this.inner.poll_next(cx)
    }

https://github.com/rust-lang/futures-rs/blob/master/futures-util/src/stream/select.rs#L113-L116

this post was submitted on 08 Jun 2025
283 points (96.7% liked)

Programmer Humor

24111 readers
1311 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 2 years ago
MODERATORS