about summary refs log blame commit diff
path: root/tvix/nix-compat-derive-tests/tests/ui/deserialize_from_str_error_not_display.rs
blob: 36cd4b1537403538b04d0e291c64e55ed24d72a1 (plain) (tree)



















                                                     
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() {}