• 0 Posts
  • 29 Comments
Joined 2 years ago
cake
Cake day: December 31st, 2023

help-circle








  • It can be useful if you want a different desktop layout for different use cases

    I set up a Personal activity, and a Work activity, with different backgrounds and different apps pinned to the taskbar. That helps maintain a “virtual” separation of work and personal life, and helps me not screw off on discord as much

    Well, it would if i actually used it








  • To explain

    There are 2 Error struct / enum declarations, probably in separate files

    To the ?, they are different types and cannot be converted from one to the other (because they are two disparate structs that happen to have the same name, but can have different bodies)

    To fix this

    You can either use .some_func_result().map_err(|err| /* conversion here/*)?; +

    Or you can impl From<Error1> for Error2

    And you should also name it ThingError, so you can visually differentiate the two


    + There are like 10 different mapping functions, depending on if you’re using an option or a result

    I never remember which one specifically i need, (unwrap_or, map_or, map_or_else, ok, ok_or)

    I usually just hunt through the auto complete list until i find the function signature that gives me what i need