# Trait cargo_test_support::prelude::IntoData

    pub trait IntoData: Sized {
        // Required method
        fn into_data(self) -> Data;

        // Provided methods
        fn raw(self) -> Data { ... }
        fn unordered(self) -> Data { ... }
        fn is(self, format: DataFormat) -> Data { ... }
        fn json(self) -> Data { ... }
        fn json_lines(self) -> Data { ... }
        fn term_svg(self) -> Data { ... }
    }

Expand description

Convert to [`Data`] with modifiers for `expected` data

## Required Methods§

#### fn into_data(self) -> Data

Convert to [`Data`], applying defaults

## Provided Methods§

#### fn raw(self) -> Data

Remove default [`filters`][crate::filter] from this `expected` result

#### fn unordered(self) -> Data

Treat lines and json arrays as unordered

##### §Examples

    use snapbox::prelude::*;
    use snapbox::str;
    use snapbox::assert_data_eq;

    let actual = str![[r#"["world", "hello"]"#]]
        .is(snapbox::data::DataFormat::Json)
        .unordered();
    let expected = str![[r#"["hello", "world"]"#]]
        .is(snapbox::data::DataFormat::Json)
        .unordered();
    assert_data_eq!(actual, expected);

#### fn is(self, format: DataFormat) -> Data

Initialize as [`format`][DataFormat] or [`Error`][DataFormat::Error]

This is generally used for `expected` data

##### §Examples

    use snapbox::prelude::*;
    use snapbox::str;

    let expected = str![[r#"{"hello": "world"}"#]]
        .is(snapbox::data::DataFormat::Json);
    assert_eq!(expected.format(), snapbox::data::DataFormat::Json);

#### fn json(self) -> Data

Initialize as json or [`Error`][DataFormat::Error]

This is generally used for `expected` data

##### §Examples

    use snapbox::prelude::*;
    use snapbox::str;

    let expected = str![[r#"{"hello": "world"}"#]]
        .json();
    assert_eq!(expected.format(), snapbox::data::DataFormat::Json);

#### fn json_lines(self) -> Data

Initialize as json lines or [`Error`][DataFormat::Error]

This is generally used for `expected` data

##### §Examples

    use snapbox::prelude::*;
    use snapbox::str;

    let expected = str![[r#"{"hello": "world"}"#]]
        .json_lines();
    assert_eq!(expected.format(), snapbox::data::DataFormat::JsonLines);

#### fn term_svg(self) -> Data

Initialize as Term SVG

This is generally used for `expected` data

## Object Safety§

This trait is not object safe.

## Implementations on Foreign Types§

§

### impl IntoData for &str

§

#### fn into_data(self) -> Data

§

### impl IntoData for &String

§

#### fn into_data(self) -> Data

§

### impl IntoData for &[u8]

§

#### fn into_data(self) -> Data

§

### impl IntoData for String

§

#### fn into_data(self) -> Data

§

### impl IntoData for Vec<u8>

§

#### fn into_data(self) -> Data

## Implementors§

§

### impl IntoData for &Data

§

### impl IntoData for Data

§

### impl IntoData for Inline