# [−][src]Macro either::try_left

    macro_rules! try_left {
        ($expr:expr) => { ... };
    }

Macro for unwrapping the left side of an `Either`, which fails early with the opposite side. Can only be used in functions that return `Either` because of the early return of `Right` that it provides.

See also `try_right!` for its dual, which applies the same just to the right side.

# Example

    #[macro_use] extern crate either;
    use either::{Either, Left, Right};

    fn twice(wrapper: Either<u32, &str>) -> Either<u32, &str> {
        let value = try_left!(wrapper);
        Left(value * 2)
    }

    fn main() {
        assert_eq!(twice(Left(2)), Left(4));
        assert_eq!(twice(Right("ups")), Right("ups"));
    }

# Help

## Keyboard Shortcuts

`?`
  Show this help dialog
`S`
  Focus the search field
`↑`
  Move up in search results
`↓`
  Move down in search results
`↹`
  Switch tab
`⏎`
  Go to active search result
`+`
  Expand all sections
`-`
  Collapse 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`)

Search multiple things at once by splitting your query with comma (e.g., `str,u8` or `String,struct:Vec,test`)