Aryan PrajapatKnowledge Contributor
What happens to owned data at the end of a Rust function?
What happens to owned data at the end of a Rust function?
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.
When writing a function that takes ownership of data, the data gets dropped (deleted) at the end of a function.
This is because all owned data gets dropped at the end of a scope, and the end of a function marks the end of a scope.