# Module error_chain::example_generated [−] [src]

These modules show an example of code generated by the macro. IT MUST NOT BE USED OUTSIDE THIS CRATE.

This is the basic error structure. You can see that `ErrorKind` has been populated in a variety of ways. All `ErrorKind`s get a `Msg` variant for basic errors. When strings are converted to `ErrorKind`s they become `ErrorKind::Msg`. The "links" defined in the macro are expanded to the `Inner` variant, and the "foreign links" to the `Io` variant.

Both types come with a variety of `From` conversions as well: `Error` can be created from `ErrorKind`, `&str` and `String`, and the `links` and `foreign_links` error types. `ErrorKind` can be created from the corresponding `ErrorKind`s of the link types, as well as from `&str` and `String`.

`into()` and `From::from` are used heavily to massage types into the right shape. Which one to use in any specific case depends on the influence of type inference, but there are some patterns that arise frequently.

## Modules

inner | Another code generated by the macro.

## Structs

Error | The Error type.

## Enums

ErrorKind | The kind of an error.

## Traits

ResultExt | Additional methods for `Result`, for easy interaction with this crate.

## Type Definitions

Result | Convenient wrapper around `std::Result`.

# Help

## Keyboard Shortcuts

?
  Show this help dialog
S
  Focus the search field
⇤
  Move up in search results
⇥
  Move down in search results
⏎
  Go to active search result
+
  Collapse/expand all sections

## Search Tricks

Prefix searches with a type followed by a colon (e.g. `fn:`) to restrict the search to a given type.

Accepted types are: `fn`, `mod`, `struct`, `enum`, `trait`, `type`, `macro`, and `const`.

Search functions by type signature (e.g. `vec -> usize` or `* -> vec`)