306
The meaning of this (lemmy.world)
you are viewing a single comment's thread
view the rest of the comments
[-] fnrir@lemmy.blahaj.zone 8 points 6 days ago

Rust: do you mean Self or self?

[-] d_k_bo@feddit.org 6 points 6 days ago* (last edited 6 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
306 points (97.2% liked)

Programmer Humor

24206 readers
669 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