Cleaning up after yourself

While the maths library is a very simple example, there may be times when you need to use a library that passes back a large block of data (such as you would expect if you created a wrapper to work with ImageMagick—a commonly used and extremely capable graphics library). When the library returns, the results are passed off to the Rust application, which you will need to deallocate manually.

To help you with this, Rust provides the Drop trait.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset