How Strings are compared in Rust?

Viewed 52

If I do this:

let a = String::from("hello world");
let b = String::from("hello world");
if a == b {
    println!("Equal!");
}

The code will print out "Equal!". But how does it exactly compare them? Does String have defined a method for comparing, or does this comparison somehow convert them to str-s, or what else?

0 Answers
Related