Udemy
    •  
    •  
    •  
    •  
    •  
    •  
    •  
    •  
Turn what you know into an opportunity and reach millions around the world.
Learn More
Your cart is empty.
Keep shopping
Building Reusable Code with Rust
Rating: 4.4 out of 5(66 ratings)
632 students

Building Reusable Code with Rust

Use generics, traits, and macros to write clean and reusable Rust libraries that are easy to understand and maintain
Last updated 4/2019
English

What you'll learn

  • Write clean and reusable Rust code for your applications
  • Use loop, map, filter and fold to avoid duplicated code
  • Understand generics and learn to use it to abstract algorithms for multiple data types
  • Define and enforce clear interface using traits
  • Work with macros and compiler plugins for metaprogramming
  • Explore how the standard library uses features such as generics, traits and macros
  • Structure your code with modules and crates and publish them online

Course content

5 sections27 lectures1h 59m total length
  • The Course Overview3:10

    This video provides an overview of the entire course.

  • Setting Up the Rust Development Environment3:45

    How can we try the code examples from the course? By setting up the Rust development environment.

       •  Understand the options available: playground and rustup

       •  Learn to test simple code using the online playground

       •  Learn to install the toolchain locally with rustup

  • Exploring Code Reuse in Rust2:34

    A brief overview of the code reuse mechanisms in Rust, which we'll discuss further in the course.

       •  Understand the considerations of code reusability

       •  Learn what Rust provides us for code reuse

  • Loops and Iterators5:40

    How do we avoid repetitive code using loops and properly use iterators?

       •  See why for loops only accept iterators

       •  Learn what the IntoIterator trait has to do with the for loop

       •  Understand the ways to get different iterators with or without reference

  • Using Functional Programming Loops12:57

    The aim of this video is to learn an alternative way of doing loops.

       •  Learn iterator adaptor and consuming adaptor

       •  Know when we should use functional programming loops as against for loops

       •  See how lazy evaluation can help you do more than a for loop

  • Functions in Rust3:06

    How we can use one of the most common features in programming languages—functions—to avoid duplication?

       •  Understand the basic syntax of functions

       •  See how functions take typed parameters

       •  Learn the common mistake of moving ownership into a function

Requirements

  • Basic knowledge of Rust programing is required.

Description

Rust is the ideal language for writing safe, correct code in a way that won't make you pull your hair out. This course will teach you how to build reusable Rust code so that you can stop copying and pasting code. Write code that can adapt to many different usages.

You will reuse code by using advanced features such as traits, generics and macros. You will work with different forms of code reuse, loops, map, filter and fold to save time and resources. Achieve higher-level reuse without sacrificing runtime performance. Organize your code into modules and crates to publish them to crates. io.

By the end of the course you will be able to avoid code duplication and write clean reusable code.

About the Author

Shing Lyu is a software engineer and open-source promoter. Shing contributed to Mozilla's Servo and Gecko (Firefox) browser engines using Rust, and is active in Rust study groups, training, and conference talks. Shing is passionate about coding, automated testing, and promoting free and open-source software craftsmanship.

Who this course is for:

  • This course will appeal to Rust developers who are already familiar with the language and want to learn how to build Rust libraries that are maintainable and reusable, and have an API that honors Rust conventions.