Crate dialoguer

Vive le français !
Je suis débutant en Rust. Pour faciliter mes débuts, j'utilise RustRover.
Je souhaiterai changer les options de réponses dans le "dialoguer::Confirm". Est-il possible de changer (y/n) par (o/n) ?
Voici mon code :

// Programme de calcul du terme n dans la suite de FIBONACCI
// La formule utilisée est l'expression fonctionnelle de BINET
// Fn = 1/sqrt(5)x(phi^n - phi'^n)
// Avec :   phi = (1+sqrt(5))/2
//          phi' = (1-sqrt(5))/2

extern crate core;
use std::io;
use dialoguer::Confirm;

fn main() {
    let cinq: f32 = 5.0;
    let phi: f32 = (1.0+cinq.sqrt())/2.0;
    let phi_prime: f32 = (1.0-cinq.sqrt())/2.0;

    //affichage pour controle
    //println!("phi : {}, phi_prime : {}", phi, phi_prime);
    loop {
        println!("quel terme désirez-vous ?");
        let mut requete = String::new();

        io::stdin()
            .read_line(&mut requete)
            .expect("Echec lecture entrée utilisateur");
        let requete: f32 = requete.trim().parse().expect("veuillez entrer un nombre");

        let terme = 1.0 / cinq.sqrt() * (&phi.powf(requete) - &phi_prime.powf(requete));
        println!("le {}ième nombre dans la suite est {}", requete.round(), terme.round());

        let confirmation = Confirm::new()
            .with_prompt("Un autre ?")
            .interact_opt()
            .unwrap();

        if confirmation.expect("REASON") {
            continue;
        } else {
            break;
        }
    }
}

J'ai suivi, d'après ce que j'ai compris, les étapes pour la confirmation. Mais pour le test de la variable confirmation, RR me rajoute ".expect("REASON")" ! Pas compris...
De plus, quand je teste la saisie, et que je tente de rentrer autre chose que "y" ou "n", en tapant sur n'importe quelle touche, plusieurs fois de suite, sans trop regarder ce que je tape, Rust panique et moi aussi !
Une âme charitable pour m'expliquer un peu, sans trop m'inonder de détails incompréhensibles ? Je débute ...
Merci d'avance

First of all, welcome to this forum.

That might be, but that doesn't change the fact that this forum is English-speaking. If you're having trouble with the English language, I can recommend the deepl.com translator.

Thanks Jofas.
No real problem with english, i think i can explain in. But in my applications i would have the display to be in french !
I agree with the fact that i should focus on understanding what i'm doing before changing anything to customise.
So, shall i repost all, in English ?
Or could you give me just a tip for that line : " if confirmation {" for what RR says "mismatched types"? Exept the commentaries, my code is in English...
Thanks

Solved !

Try to delete the post but doesn't work. Can you do it for me ?
And thanks for all

No, I can't delete your post. I think it would be best if you could describe how you solved it and mark your answer as the solution to this topic. This might help others in the future that have a similar problem. As far as I can see, the Y/N option is hard-coded into dialoguer, I don't see how you can change that to O/N.

1 Like

Ok, i'll do that.
Thanks

Solved !
It was misunderstanding between "dialoguer::Confirm.interact" and " dialoguer::Confirm.interact_opt".
The first doesn't offer the "quit" or "esc" option.
That's what i want !

Done