mycorrizhal-model/src/string.rs:45
im a liiiittle cautious on this. would need to doublecheck whether or not this is safe. the transmute macro is from the implementation of a bytemuck tool that is essentially the same thing as what i'm doing here. and that does not use a raw pointer cast for the conversion. want to double check that its not because its somehow unsafe
mycorrizhal-model/src/string.rs:52
first of all this should be suffixed _unchecked if it's not doing validations. second i dont think i want this at all tbh? ... i dont see much reason to have it since its the same as from_str_unchecked("something").into(). for now at least i want to align with what std has for converting between &[u8] and &str since we're doing the equivalent here. just between &str and &ConstrainedStr
mycorrizhal-model/src/string.rs:61
not entirely sure what was even changed here ... tangled being weird but uhh yea im not sure bwa
mycorrizhal-model/src/string.rs:165
mycorrizhal-model/src/string.rs:220
i see no reason to change these to use that helper bwa. especially not if we're getting rid of it
mycorrizhal-model/src/string.rs:230
ToOwned is something i've deliberately avoided implementing for now. ToOwned generally has a growable as the target Owned (eg. str implements ToOwned<Owned = String> instead of ToOwned<Owned = Box<str>). imo this is a design flaw in the ToOwned trait but we probably just need to accept that. before implementing it i need to figure out if i want to have the ToOwned target be growable/mutable versions of these things (and if so then how) or if ToOwned<Owned = Box<ConstrainedStr> like here is fine.
mycorrizhal-model/tests/interop.rs:1
(to mycorrizhal-model/tests as a whole)
these are unit tests and not integration tests to definetly shouldnt go in the tests directory. im also not sure yet that this is how i want to handle the atproto-interop tests in general. and theres a lot of muddling handle specific stuff with seemingly generic stuff in this version too. i think just wait with this for now.
mycorrizhal-model/src/string/handle.rs:105
i think from_str_normalizing would probably be better? just to make the name more self documenting in relation to from_str. i also dont love the use of Cow here tbh. Cow is a decently tricky and annoying type to deal with i dont want to force people into that just to have a normalised handle. &mut str works just as well since we dont actually need to grow the str to lowercase it. also avoids a heap allocation. id also like to introduce a more generic approach to this since multiple of the string formats have normalisation behaviour. and thats probably going to be &mut str based for the same reasons (since im pretty sure atproto doesnt actually have any string formats where normalisation may require growing the str)
mycorrizhal-model/src/string/handle.rs:58
the validation logic should be in the validator. not an intrinsic impl on the HandleStr. also not a huge fan of the actual validation being in a separate domain module. handles and valid DNS names aren't actually the same syntax so it's not like we'd actually be able to reuse that validation logic for something else (unless you thought of some use case i didnt?)
mycorrizhal-model/src/string/handle.rs:9
this could maybe be better as a const fn rather than a macro? HandleStr::from_str_unwrapped? names are hard ... tho tbf doing "compile time unwrap" like this in a macro is pretty standard practice to maybe just keeping is as a macro solves the naming issue.
this would be so much better if Result::unwrap was just const ...
in general being able to make all these values at compile time is a core goal. idk if i love or hate having per format macros/functions ... keep it for now i can remove it later if i hate it