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

New post: Simple Rust, Part Three #13

Merged
merged 3 commits into from Dec 30, 2015

Conversation

Projects
None yet
3 participants
@IanWhitney
Owner

IanWhitney commented Nov 27, 2015

No description provided.

@cafreeman

This comment has been minimized.

Show comment
Hide comment
@cafreeman

cafreeman Dec 8, 2015

Unless I'm missing something, I believe you have to declare anagrams_for as a public function before you can get the tests to pass. For instance, I wasn't able to pass the first test until my function looked like this:

pub fn anagrams_for<'a>(source: &str, inputs: &[&'a str]) -> Vec<&'a str> {
    vec![]
}

Did you experience the same thing? If so, it might be worth updating the code example to include the pub declaration.

cafreeman commented Dec 8, 2015

Unless I'm missing something, I believe you have to declare anagrams_for as a public function before you can get the tests to pass. For instance, I wasn't able to pass the first test until my function looked like this:

pub fn anagrams_for<'a>(source: &str, inputs: &[&'a str]) -> Vec<&'a str> {
    vec![]
}

Did you experience the same thing? If so, it might be worth updating the code example to include the pub declaration.

@IanWhitney

This comment has been minimized.

Show comment
Hide comment
@IanWhitney

IanWhitney Dec 8, 2015

Owner

You are right, @cafreeman. In a lot of cases I was writing code as if everything was in a single file, like this. In that case, I can leave the pub off. But when you're dealing with the Exercism code, you have to have pub since you're importing your anagram code as an external crate. I'll try to make that more clear.

Owner

IanWhitney commented Dec 8, 2015

You are right, @cafreeman. In a lot of cases I was writing code as if everything was in a single file, like this. In that case, I can leave the pub off. But when you're dealing with the Exercism code, you have to have pub since you're importing your anagram code as an external crate. I'll try to make that more clear.

IanWhitney added a commit that referenced this pull request Dec 30, 2015

Merge pull request #13 from IanWhitney/simple_rust_three
New post: Simple Rust, Part Three

@IanWhitney IanWhitney merged commit 227862f into master Dec 30, 2015

@IanWhitney IanWhitney deleted the simple_rust_three branch Dec 30, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment