Course programme
Handling All Kinds of Errors with Result and Option
7 lectures 52:13
The Course Overview
This video will give you an overview about the course.
Error Handling in Rust
How can we handle both a good result, and an error from the same function?
• Learn about the Enum Result
• Learn how match statements can split the possibilities
• Create a match statement that handles the different cases
Avoid Using Match with Combinators
While "match" is effective, with multiple errors this can lead to lengthy code.
• Learn about the combinator methods on Result
• Learn how to write closures and anonymous functions
• Use the “and_then” combinator, to make our code shorter and easier to read
Results and Options
Sometimes, you need to work with things that may or may not exist.
• Learn about the Option Enum Type
• Learn about the methods that convert between them
• Have a function return an option when from an error
Building Our Own Error Type
If our function needs to return a result but could have multiple different errors, we need to be able to tell return them in a strongly typed system.
• Learn how to build a new type
• Learn how to implement it from trait
• Use the into method, and “?” operator, so as to create our error from other error types
Splitting Our Codes between Modules and Crates
Different crates and modules create different errors. We need to handle errors across module barriers.
• Split our project into separate modules
• Create an application and a library within the same crate
• Make sure errors can be passed around across the crate boundaries
Introducing the Failure Crate
Many libraries and useful code is out there ready for us to use. How can we get it ready to include in our own code?
• Introduce Crates.io, and how we can find crates to do a job
• Include the "Failure" crate in our cargo.toml
• Use the fail trait and error type to combine different error types
Handling All Kinds of Errors with Result and Option- Quiz
Handling All Kinds of Errors with Result and Option.
7 lectures 52:13
The Course Overview
This video will give you an overview about the course.
Error Handling in Rust
How can we handle both a good result, and an error from the same function?
• Learn about the Enum Result
• Learn how match statements can split the possibilities
• Create a match statement that handles the different cases
Avoid Using Match with Combinators
While "match" is effective, with multiple errors this can lead to lengthy code.
• Learn about the combinator methods on Result
• Learn how to write closures and anonymous functions
• Use the “and_then” combinator, to make our code shorter and easier to read
Results and Options
Sometimes, you need to work with things that may or may not exist.
• Learn about the Option Enum Type
• Learn about the methods that convert between them
• Have a function return an option when from an error
Building Our Own Error Type
If our function needs to return a result but could have multiple different errors, we need to be able to tell return them in a strongly typed system.
• Learn how to build a new type
• Learn how to implement it from trait
• Use the into method, and “?” operator, so as to create our error from other error types
Splitting Our Codes between Modules and Crates
Different crates and modules create different errors. We need to handle errors across module barriers.
• Split our project into separate modules
• Create an application and a library within the same crate
• Make sure errors can be passed around across the crate boundaries
Introducing the Failure Crate
Many libraries and useful code is out there ready for us to use. How can we get it ready to include in our own code?
• Introduce Crates.io, and how we can find crates to do a job
• Include the "Failure" crate in our cargo.toml
• Use the fail trait and error type to combine different error types
Handling All Kinds of Errors with Result and Option- Quiz
The Course Overview
This video will give you an overview about the course.
The Course Overview
This video will give you an overview about the course.
The Course Overview
This video will give you an overview about the course.
The Course Overview
This video will give you an overview about the course.
This video will give you an overview about the course.
This video will give you an overview about the course.
Error Handling in Rust
How can we handle both a good result, and an error from the same function?
• Learn about the Enum Result
• Learn how match statements can split the possibilities
• Create a match statement that handles the different cases
Error Handling in Rust
How can we handle both a good result, and an error from the same function?
• Learn about the Enum Result
• Learn how match statements can split the possibilities
• Create a match statement that handles the different cases
Error Handling in Rust
How can we handle both a good result, and an error from the same function?
• Learn about the Enum Result
• Learn how match statements can split the possibilities
• Create a match statement that handles the different cases
Error Handling in Rust
How can we handle both a good result, and an error from the same function?
• Learn about the Enum Result
• Learn how match statements can split the possibilities
• Create a match statement that handles the different cases
How can we handle both a good result, and an error from the same function?
• Learn about the Enum Result
• Learn how match statements can split the possibilities
• Create a match statement that handles the different cases
How can we handle both a good result, and an error from the same function?
• Learn about the Enum Result
• Learn how match statements can split the possibilities
• Create a match statement that handles the different cases
Avoid Using Match with Combinators
While "match" is effective, with multiple errors this can lead to lengthy code.
• Learn about the combinator methods on Result
• Learn how to write closures and anonymous functions
• Use the “and_then” combinator, to make our code shorter and easier to read
Avoid Using Match with Combinators
While "match" is effective, with multiple errors this can lead to lengthy code.
• Learn about the combinator methods on Result
• Learn how to write closures and anonymous functions
• Use the “and_then” combinator, to make our code shorter and easier to read
Avoid Using Match with Combinators
While "match" is effective, with multiple errors this can lead to lengthy code.
• Learn about the combinator methods on Result
• Learn how to write closures and anonymous functions
• Use the “and_then” combinator, to make our code shorter and easier to read
Avoid Using Match with Combinators
While "match" is effective, with multiple errors this can lead to lengthy code.
• Learn about the combinator methods on Result
• Learn how to write closures and anonymous functions
• Use the “and_then” combinator, to make our code shorter and easier to read
While "match" is effective, with multiple errors this can lead to lengthy code.
• Learn about the combinator methods on Result
• Learn how to write closures and anonymous functions
• Use the “and_then” combinator, to make our code shorter and easier to read
While "match" is effective, with multiple errors this can lead to lengthy code.
• Learn about the combinator methods on Result
• Learn how to write closures and anonymous functions
• Use the “and_then” combinator, to make our code shorter and easier to read
Results and Options
Sometimes, you need to work with things that may or may not exist.
• Learn about the Option Enum Type
• Learn about the methods that convert between them
• Have a function return an option when from an error
Results and Options
Sometimes, you need to work with things that may or may not exist.
• Learn about the Option Enum Type
• Learn about the methods that convert between them
• Have a function return an option when from an error
Results and Options
Sometimes, you need to work with things that may or may not exist.
• Learn about the Option Enum Type
• Learn about the methods that convert between them
• Have a function return an option when from an error
Results and Options
Sometimes, you need to work with things that may or may not exist.
• Learn about the Option Enum Type
• Learn about the methods that convert between them
• Have a function return an option when from an error
Sometimes, you need to work with things that may or may not exist.
• Learn about the Option Enum Type
• Learn about the methods that convert between them
• Have a function return an option when from an error
Sometimes, you need to work with things that may or may not exist.
• Learn about the Option Enum Type
• Learn about the methods that convert between them
• Have a function return an option when from an error
Building Our Own Error Type
If our function needs to return a result but could have multiple different errors, we need to be able to tell return them in a strongly typed system.
• Learn how to build a new type
• Learn how to implement it from trait
• Use the into method, and “?” operator, so as to create our error from other error types
Building Our Own Error Type
If our function needs to return a result but could have multiple different errors, we need to be able to tell return them in a strongly typed system.
• Learn how to build a new type
• Learn how to implement it from trait
• Use the into method, and “?” operator, so as to create our error from other error types
Building Our Own Error Type
If our function needs to return a result but could have multiple different errors, we need to be able to tell return them in a strongly typed system.
• Learn how to build a new type
• Learn how to implement it from trait
• Use the into method, and “?” operator, so as to create our error from other error types
Building Our Own Error Type
If our function needs to return a result but could have multiple different errors, we need to be able to tell return them in a strongly typed system.
• Learn how to build a new type
• Learn how to implement it from trait
• Use the into method, and “?” operator, so as to create our error from other error types
If our function needs to return a result but could have multiple different errors, we need to be able to tell return them in a strongly typed system.
• Learn how to build a new type
• Learn how to implement it from trait
• Use the into method, and “?” operator, so as to create our error from other error types
If our function needs to return a result but could have multiple different errors, we need to be able to tell return them in a strongly typed system.
• Learn how to build a new type
• Learn how to implement it from trait
• Use the into method, and “?” operator, so as to create our error from other error types
Splitting Our Codes between Modules and Crates
Different crates and modules create different errors. We need to handle errors across module barriers.
• Split our project into separate modules
• Create an application and a library within the same crate
• Make sure errors can be passed around across the crate boundaries
Splitting Our Codes between Modules and Crates
Different crates and modules create different errors. We need to handle errors across module barriers.
• Split our project into separate modules
• Create an application and a library within the same crate
• Make sure errors can be passed around across the crate boundaries
Splitting Our Codes between Modules and Crates
Different crates and modules create different errors. We need to handle errors across module barriers.
• Split our project into separate modules
• Create an application and a library within the same crate
• Make sure errors can be passed around across the crate boundaries
Splitting Our Codes between Modules and Crates
Different crates and modules create different errors. We need to handle errors across module barriers.
• Split our project into separate modules
• Create an application and a library within the same crate
• Make sure errors can be passed around across the crate boundaries
Different crates and modules create different errors. We need to handle errors across module barriers.
• Split our project into separate modules
• Create an application and a library within the same crate
• Make sure errors can be passed around across the crate boundaries
Different crates and modules create different errors. We need to handle errors across module barriers.
• Split our project into separate modules
• Create an application and a library within the same crate
• Make sure errors can be passed around across the crate boundaries
Introducing the Failure Crate
Many libraries and useful code is out there ready for us to use. How can we get it ready to include in our own code?
• Introduce Crates.io, and how we can find crates to do a job
• Include the "Failure" crate in our cargo.toml
• Use the fail trait and error type to combine different error types
Introducing the Failure Crate
Many libraries and useful code is out there ready for us to use. How can we get it ready to include in our own code?
• Introduce Crates.io, and how we can find crates to do a job
• Include the "Failure" crate in our cargo.toml
• Use the fail trait and error type to combine different error types
Introducing the Failure Crate
Many libraries and useful code is out there ready for us to use. How can we get it ready to include in our own code?
• Introduce Crates.io, and how we can find crates to do a job
• Include the "Failure" crate in our cargo
Building on the IntoIterator Trait
Not everything you want to iterate over,...