Chapter 6 of Rust - Detailed explanation of error handling (enumeration, generics)


foreword

The catalog of this series of tutorials can be viewed here: Rust Tutorial Catalog

This chapter is about error handling in Rust, which is very different from many other languages.

And in Rust code, you will also encounter it very frequently, so in order to further learn other features in Rust, it is necessary to learn about error handling in Rust

1. What's the difference?

As mentioned earlier, the error handling method of Rust language is very different from that of many other languages.

For now, there are two mainstream error forms: returning error codes and throwing exceptions

Among them, the return error code &#x used in the c language

Guess you like

Origin blog.csdn.net/weixin_50964512/article/details/130603673