I want to do basically this:

struct MyStruct < T> {
    data: T
}

impl < T> for MyStruct < T> {
    fn foo() {
        println!("Generic")
    }
}

impl for MyStruct < u32> {
    fn foo() {
        println!("u32")
    }
}

I have tried doing

impl < T: !u32> for MyStruct < T> {
    ...
}

But it doesn’t seem to work. I’ve also tried various things with traits but none of them seem to work. Is this even possible?

EDIT: Fixed formatting

  • calcopiritus@lemmy.worldOP
    link
    fedilink
    arrow-up
    2
    ·
    edit-2
    1 year ago

    I’m sorry, no wonder you are lost, so it made no sense when you wrote this comment, lemmy deleted everything between the “less than” character and “>”. I had to change them for “<” in order for them not to get deleted.

    • RunAwayFrog
      link
      fedilink
      arrow-up
      5
      ·
      1 year ago

      lemmy deleted everything between the “less than” character and “>”.

      Lemmy also escaped the ampersands in their comment’s link 😉

      Isn’t broken sanitization great!