I am new to Rust & I am having trouble to compare mutable strings and immutable strings.
Please find below a code block which should exit if "exit" is entered. But I am having problem with the same and so I put in some lines to get the hang of the comparison. But all is returning false.
How to write the comparison such that the comparison returns true?
use std::io::{self, BufRead};
fn main() {
let mut input_line = String::new();
let stdin = io::stdin();
let mut input_handler=stdin.lock();
let exit_str=String::from("exit");
println!("Output=={}","exit".eq(&exit_str));
while exit_str.ne(&mut input_line){
input_line = String::new();
let _=input_handler.read_line(&mut input_line);
print!("surrealdbcli:");
println!("Your Input={}",input_line);
println!("Is your input \"exit\"? {}",exit_str.eq(&input_line.as_str()));
println!("Is your input \"exit\"? {}","exit".eq(input_line.as_str()));
println!("Is your input \"exit\"? {}",(String::from("exit")).eq((&input_line).into()));
println!("Is your input \"exit\"? {}","exit".eq(&input_line));
let temp_str=input_line.to_string();
println!("Is your input \"exit\"? {}",(String::from("exit")).eq(&temp_str));
println!("Is your input \"exit\"? {}",String::from("exit").eq(&temp_str));
println!("Is your input \"exit\"? {}",temp_str.eq("exit"));
println!("Is your input \"exit\"? {}",exit_str.eq(&temp_str));
println!("Is your input \"exit\"? {}","exit".eq(&temp_str));
println!("Is your input \"exit\"? {}",(String::from("exit")).eq((&temp_str).into()));
}
}