nix_serialize_remote!() { /* proc-macro */ }
Expand description
Macro to implement NixSerialize
on a type.
Sometimes you can’t use the deriver to implement NixSerialize
(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(display)]
, #[nix(display = "path")]
,
#[nix(store_dir_display)]
, #[nix(into = "IntoType")]
or
#[nix(try_into = "IntoType")]
if you could.
§Example
#[derive(Clone)]
struct MyU64(u64);
impl From<MyU64> for u64 {
fn from(value: MyU64) -> Self {
value.0
}
}
nix_serialize_remote!(#[nix(into="u64")] MyU64);