You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A lot of things are just strings. These could made type safe by creating types for these things and using shrinkwraprs to retain all the expected methods from string.
#12
Closed
suchapalaver opened this issue
Nov 8, 2021
· 1 comment
Here the types do not make clear which items are used in which places. For example GroceriesSection::String is totally unrelated to the items in Recipe::ingredients. However GroceriesSection::items is the same. So rather than all of these being just String you could have types like:
#[derive(Shrinkwrap)]
struct RecipeName(String);
#[derive(Shrinkwrap)]
struct Ingredient{ name: String }
``
etc. (using shrinkwraprs 3)
This would make things like `ShoppingList` much easier to understand by looking at the struct.
The text was updated successfully, but these errors were encountered:
For example you have:
Here the types do not make clear which items are used in which places. For example
GroceriesSection::String
is totally unrelated to the items inRecipe::ingredients
. HoweverGroceriesSection::items
is the same. So rather than all of these being justString
you could have types like:The text was updated successfully, but these errors were encountered: