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

&str.splitn() not implemented #24075

Closed
Wazubaba opened this issue Apr 4, 2015 · 7 comments
Closed

&str.splitn() not implemented #24075

Wazubaba opened this issue Apr 4, 2015 · 7 comments
Labels
A-trait-system Area: Trait system A-type-system Area: Type system

Comments

@Wazubaba
Copy link

Wazubaba commented Apr 4, 2015

To start with, I'm relatively new to the language, and I'm trying to use &str.splitn(). According to what I could determine from the API, it should have an nth() member, yet it doesn't seem to. It also seems to be missing other members too.

My test is:

    let var = "meow".splitn(1, "e").nth(1);

Which gives me the error:

    error: type `core::str::SplitN<'_, &str>` does not implement any method in scope named `nth` 

This however allows it to work: http://is.gd/Vdjy8i (Thanks to Steveklabnik from the rust IRC channel)

This is using rustc 1.0.0-beta (9854143cb 2015-04-02) (built 2015-04-02).

@steveklabnik steveklabnik added A-type-system Area: Type system A-trait-system Area: Trait system A-libs labels Apr 4, 2015
@steveklabnik
Copy link
Member

So, while that doesn't work, passing a closure as a pattern does:

let var = "meow".splitn(1, {|x| x == 'm' }).nth(1);

So there's something about SplitN that's not properly fufilling the Iterator implementation

@steveklabnik
Copy link
Member

/cc @nikomatsakis

@mhristache
Copy link

I discussed this one with @Kimundi on IRC some days ago and he said he has a fix for it in the pipeline

@Kimundi
Copy link
Member

Kimundi commented Apr 5, 2015

See #23952

@oli-obk
Copy link
Contributor

oli-obk commented Apr 7, 2015

so this can be closed now that #23952 is merged?

@steveklabnik
Copy link
Member

The test case still fails with the same error.

@alexcrichton
Copy link
Member

@steveklabnik I think last night's nightly didn't succeed, but I do believe @oli-obk is right in that @Kimundi fixed this in #23952. As a result, closing!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-trait-system Area: Trait system A-type-system Area: Type system
Projects
None yet
Development

No branches or pull requests

6 participants