# syn::parse::IResult - Rust
API documentation for the Rust `IResult` enum in crate `syn`.
Keywords: rust, rustlang, rust-lang, IResult

# [−] [src] Enum syn::parse::IResult

    pub enum IResult<I, O> {
        Done(I, O),
        Error,
    }

The result of a parser.

## Variants

`Done(I, O)`

Parsing succeeded. The first field contains the rest of the unparsed data and the second field contains the parse result.

`Error`

Parsing failed.

## Implementations

### `impl<'a, O> IResult<&'a str, O>` [src]

#### `pub fn expect(self, name: &str) -> O` [src]

Unwraps the result, asserting the the parse is complete. Panics with a message based on the given string if the parse failed or is incomplete.

    extern crate syn;
    #[macro_use] extern crate synom;

    use syn::Ty;
    use syn::parse::ty;

    // One or more Rust types separated by commas.
    named!(comma_separated_types -> Vec<Ty>,
        separated_nonempty_list!(punct!(","), ty)
    );

    fn main() {
        let input = "&str, Map<K, V>, String";

        let parsed = comma_separated_types(input).expect("comma-separated types");

        assert_eq!(parsed.len(), 3);
        println!("{:?}", parsed);
    }

## Trait Implementations

### `impl<I, O> Clone for IResult<I, O> where
I: Clone,
O: Clone,` [src]

#### `pub fn clone(&self) -> IResult<I, O>` [src]

Returns a copy of the value. Read more

#### `pub fn clone_from(&mut self, source: &Self)`1.0.0 [src]

Performs copy-assignment from `source`. Read more

### `impl<I, O> Debug for IResult<I, O> where
I: Debug,
O: Debug,` [src]

#### `pub fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>` [src]

Formats the value using the given formatter. Read more

### `impl<I, O> Eq for IResult<I, O> where
I: Eq,
O: Eq,` [src]

### `impl<I, O> PartialEq<IResult<I, O>> for IResult<I, O> where
I: PartialEq<I>,
O: PartialEq<O>,` [src]

#### `pub fn eq(&self, other: &IResult<I, O>) -> bool` [src]

This method tests for `self` and `other` values to be equal, and is used by `==`. Read more

#### `pub fn ne(&self, other: &IResult<I, O>) -> bool` [src]

This method tests for `!=`.

### `impl<I, O> StructuralEq for IResult<I, O>` [src]

### `impl<I, O> StructuralPartialEq for IResult<I, O>` [src]

## Auto Trait Implementations

### `impl<I, O> RefUnwindSafe for IResult<I, O> where
I: RefUnwindSafe,
O: RefUnwindSafe,` [src]

### `impl<I, O> Send for IResult<I, O> where
I: Send,
O: Send,` [src]

### `impl<I, O> Sync for IResult<I, O> where
I: Sync,
O: Sync,` [src]

### `impl<I, O> Unpin for IResult<I, O> where
I: Unpin,
O: Unpin,` [src]

### `impl<I, O> UnwindSafe for IResult<I, O> where
I: UnwindSafe,
O: UnwindSafe,` [src]

## Blanket Implementations

### `impl<T> Any for T where
T: 'static + ?Sized,` [src]

#### `pub fn type_id(&self) -> TypeId` [src]

Gets the `TypeId` of `self`. Read more

### `impl<T> Borrow<T> for T where
T: ?Sized,` [src]

#### `pub fn borrow(&self) -> &T` [src]

Immutably borrows from an owned value. Read more

### `impl<T> BorrowMut<T> for T where
T: ?Sized,` [src]

#### `pub fn borrow_mut(&mut self) -> &mut T` [src]

Mutably borrows from an owned value. Read more

### `impl<T> From<T> for T` [src]

#### `pub fn from(t: T) -> T` [src]

Performs the conversion.

### `impl<T, U> Into<U> for T where
U: From<T>,` [src]

#### `pub fn into(self) -> U` [src]

Performs the conversion.

### `impl<T> ToOwned for T where
T: Clone,` [src]

#### `type Owned = T`

The resulting type after obtaining ownership.

#### `pub fn to_owned(&self) -> T` [src]

Creates owned data from borrowed data, usually by cloning. Read more

#### `pub fn clone_into(&self, target: &mut T)` [src]

🔬 This is a nightly-only experimental API. (`toowned_clone_into`)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

### `impl<T, U> TryFrom<U> for T where
U: Into<T>,` [src]

#### `type Error = Infallible`

The type returned in the event of a conversion error.

#### `pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>` [src]

Performs the conversion.

### `impl<T, U> TryInto<U> for T where
U: TryFrom<T>,` [src]

#### `type Error = <U as TryFrom<T>>::Error`

The type returned in the event of a conversion error.

#### `pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>` [src]

Performs the conversion.