about summary refs log tree commit diff
path: root/tvix/nix-compat-derive-tests/tests/ui/deserialize_from_str_error_not_display.rs
blob: 36cd4b1537403538b04d0e291c64e55ed24d72a1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
use std::str::FromStr;

use nix_compat_derive::NixDeserialize;

#[derive(NixDeserialize)]
#[nix(from_str)]
pub struct Test;

impl FromStr for Test {
    type Err = ();
    fn from_str(s: &str) -> Result<Self, Self::Err> {
        if s == "test" {
            Ok(Test)
        } else {
            Err(())
        }
    }
}

fn main() {}