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

Store and write namespaces #27

Merged
merged 3 commits into from
Sep 5, 2016
Merged

Store and write namespaces #27

merged 3 commits into from
Sep 5, 2016

Conversation

jameshurst
Copy link
Member

Namespaces are stored in channel.namespaces so that custom namespaces can be resolved and written.

continue;
}

let key = try!(str::from_utf8(name)).to_string();
Copy link
Member

@frewsxcv frewsxcv Sep 5, 2016

Choose a reason for hiding this comment

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

This could maybe be try!(String::from_utf8(name))?

Copy link
Member Author

Choose a reason for hiding this comment

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

We're not able to use String::from_utf8 here since name is a &[u8] and String::from_utf8 requires a Vec<u8>.

Copy link
Member

Choose a reason for hiding this comment

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

Ah, in that case, I suppose try!(String::from_utf8(name.to_owned())) is not much of an improvement. Carry on.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, I decided to go with str::from_ut8 just so the bytes are verified to be valid UTF-8 before duplicating them in to a Vec/String.

@jameshurst jameshurst merged commit a4f50e8 into master Sep 5, 2016
@jameshurst jameshurst deleted the write-ns branch September 5, 2016 20:54
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