Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update deck.rs #2

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

TheDeveloper101
Copy link

Created a rough method to be able to get a card. But the method requires the name of the card to be passed in as an AbstractCard. Also the method returns an AbstractCard and it would be nice if it could return a string. I am not sure how to make it such that the method will simply return a card from the HashBag but this is what I could come up with

@@ -59,6 +61,10 @@ impl Deck {
self.mainboard.insert_many(card, count)
}

pub fn get_card(&self, card: &AbstractCard) -> AbstractCard {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I doubt the usefulness of this method. Let's say the deck does contain the given card in the mainboard. You are getting it, cloning it, and returning it to the user. However, the returned card should contain all the same information that the given card does. Based on our conversation elsewhere, I believe you want to add methods on the AbstractCard struct.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants