Aryan PrajapatKnowledge Contributor
What does the Rust question mark operator do?
What does the Rust question mark operator do?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Questions | Answers | Discussions | Knowledge sharing | Communities & more.
The question mark operator in Rust offers a convenient way to handle errors or missing data.
When used with Result, the question mark operator will either:
unwrap an Ok
or return an Err
When it’s used with Option, it will either:
unwrap a Some
or return a None
Because the question mark operator potentially returns values, the function signature must have either Result or Option set as the return type.