Here's an example of what I've tried.
static TARGET: &'static str = "a string";
fn main () {
printfln!("%?", TARGET.eq(~"other string"));
}
I looked at equiv
too, but no luck. The string I compare to the TARGET has to be an owned pointer string.
This works here:
static TARGET: &'static str = "a string";
fn main () {
println!("{}", TARGET == "a string");
println!("{}", TARGET == ~"a string");
let other = ~"a string";
println!("{}", TARGET == other);
}
It prints:
true
true
true