Warning
This post was published 47 days ago. The information described in this article may have changed.
I've saw something like
fn something<T: SomeTrait>(thingy: T) {
T::some_method()
}
or
fn something<T: SomeTrait>(thingy: T) {
T.some_method()
}
the other day and I have no idea what this is doing, but I'm pretty sure it compiled.
I attemped to google "rust call method on type parameter" and "rust call method on trait bound" but got nothing back, and crapgpt was no help either. I've been doing rust for quite a bit and have never seen this before, so I feel it must be some kind of obscure syntax thing.
Please enlighten me as to what on earth is going on here.
16 posts - 6 participants
🏷️ rust_feed