feat(nix-compat/narinfo/signature): generalize name field
Requiring `name` to be a `&str` means it'll get annoying to pass around `Signature`, but being able to pass them around in an owned fashion is kinda a requirement for a stronger typed `PathInfo` struct, where we want to have full ownership. Rework the `Signature` struct to become generic over the type of the `name` field. This means, it becomes possible to have owned versions of it. We don't want to impose `String` or `SmolStr` for example, but want to leave it up to the nix-compat user to decide. Provide a type alias for the existing `&str` variant (`SignatureRef`), and use it where we previously used the non-generic `Signature` one. Add some tests to ensure it's possible to *use* `Signature` with both `String` and `SmolStr` (but only pull in `smol_str` as dev dependency for the tests). Also, add some more docstrings, these were a bit sparse. Change-Id: I3f75691498c6bda9cd072d2d9dac83c4f6c57287 Reviewed-on: https://cl.tvl.fyi/c/depot/+/12253 Autosubmit: flokli <flokli@flokli.de> Tested-by: BuildkiteCI Reviewed-by: raitobezarius <tvl@lahfa.xyz>
This commit is contained in:
parent
7612cb4c31
commit
a259613c76
9 changed files with 117 additions and 45 deletions
|
@ -7480,6 +7480,10 @@ rec {
|
|||
name = "serde_json";
|
||||
packageId = "serde_json";
|
||||
}
|
||||
{
|
||||
name = "smol_str";
|
||||
packageId = "smol_str";
|
||||
}
|
||||
{
|
||||
name = "tokio-test";
|
||||
packageId = "tokio-test";
|
||||
|
@ -9301,7 +9305,7 @@ rec {
|
|||
}
|
||||
{
|
||||
name = "itertools";
|
||||
packageId = "itertools 0.10.5";
|
||||
packageId = "itertools 0.13.0";
|
||||
usesDefaultFeatures = false;
|
||||
features = [ "use_alloc" ];
|
||||
}
|
||||
|
@ -9421,7 +9425,7 @@ rec {
|
|||
}
|
||||
{
|
||||
name = "itertools";
|
||||
packageId = "itertools 0.10.5";
|
||||
packageId = "itertools 0.13.0";
|
||||
}
|
||||
{
|
||||
name = "proc-macro2";
|
||||
|
@ -12491,9 +12495,9 @@ rec {
|
|||
};
|
||||
"smol_str" = rec {
|
||||
crateName = "smol_str";
|
||||
version = "0.2.1";
|
||||
version = "0.2.2";
|
||||
edition = "2018";
|
||||
sha256 = "0jca0hyrwnv428q5gxhn2s8jsvrrkyrb0fyla9x37056mmimb176";
|
||||
sha256 = "1bfylqf2vnqaglw58930vpxm2rfzji5gjp15a2c0kh8aj6v8ylyx";
|
||||
authors = [
|
||||
"Aleksey Kladov <aleksey.kladov@gmail.com>"
|
||||
];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue