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
I didn't add any way to make sure fund names are unique upon creation, so two funds with the same name can be added. The get_by_name function returns only one, whichever one it finds first, rendering one or the other inaccessible depending on how the Fund Vector is sorted. Implementing PartialEq on Fund would allow to check if a fund by the name already exists in the Fund Vector before adding it, and the Fund::new() function can return an error if it does.
The text was updated successfully, but these errors were encountered:
I just realized Fund::new() has no way of checking the Fund Vector. Perhaps the best way to fix this is to create a sort of FundManager struct that holds the Fund Vector and abstracts some of Fund's functionality.
In GitLab by @leggettc18 on Sep 28, 2018, 20:43
I didn't add any way to make sure fund names are unique upon creation, so two funds with the same name can be added. The
get_by_name
function returns only one, whichever one it finds first, rendering one or the other inaccessible depending on how the Fund Vector is sorted. ImplementingPartialEq
onFund
would allow to check if a fund by the name already exists in the Fund Vector before adding it, and theFund::new()
function can return an error if it does.The text was updated successfully, but these errors were encountered: