Creating Your Own Crate

Most languages allow for external libraries to be created. These typically contain commonly used pieces of code that are for general use. For example, libraries for deserializing JSON are fairly common, as are math libraries. Rust is no exception. It allows for the creation of libraries (known as crates). These crates can be kept to yourself or distributed however you see fit. The metadata about crates is stored on a public service, at https://crates.io/.

In this chapter, we will cover the following topics:

  • How crates are created
  • How the directory structure is used
  • How crates are made up of modules
  • How to include your crate within your code
  • How scopes are used with your modules
..................Content has been hidden....................

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