vendredi 2 avril 2021

Check the struct of a Variable in Rust

Im in a program where the actions are decided upon whether a variable is a certain struct or not. I was wondering what crate or native way is there to check this.

I tried doing (rough code, does not represent the actual code) However this did not work

struct User {
   //whatever code may go here
}

fn main() {
    //assign the struct to variable user

    if user == User {
         //code
}
}

Aucun commentaire:

Enregistrer un commentaire