nix_compat_derive

Macro nix_deserialize_remote

Source
nix_deserialize_remote!() { /* proc-macro */ }
Expand description

Macro to implement NixDeserialize on a type. Sometimes you can’t use the deriver to implement NixDeserialize (like when dealing with types in Rust standard library) but don’t want to implement it yourself. So this macro can be used for those situations where you would derive using #[nix(from_str)], #[nix(from = "FromType")] or #[nix(try_from = "FromType")] if you could.

§Example
struct MyU64(u64);

impl From<u64> for MyU64 {
    fn from(value: u64) -> Self {
        Self(value)
    }
}

nix_deserialize_remote!(#[nix(from="u64")] MyU64);