Skip to content

Added Encodable and Decodable for Arc<T>. #18334

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

Merged
merged 1 commit into from Oct 28, 2014
Merged

Added Encodable and Decodable for Arc<T>. #18334

merged 1 commit into from Oct 28, 2014

Conversation

ghost
Copy link

@ghost ghost commented Oct 26, 2014

No description provided.

@reem
Copy link
Contributor

reem commented Oct 26, 2014

I'm not sure what the added utility of these methods is; can't you just call .encode if the underlying data is Encodable and just do Arc::new(Decodable::decode(data)) to get Arc<D> where D: Decodable<...>?

@ghost
Copy link
Author

ghost commented Oct 26, 2014

@reem it allows #[deriving(Encodable, Decodable)] to work if the structure has an Arc pointer embedded inside of it. Same reason Rc<T> and Box<T> support it.

eg:

#[deriving(Encodable, Decodable)]
struct foo {
    bar: Arc<uint>
}

alexcrichton added a commit to alexcrichton/rust that referenced this pull request Oct 27, 2014
@bors bors merged commit 8a4bd84 into rust-lang:master Oct 28, 2014
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.

3 participants