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

std::io::Take should have into_inner() method #23755

Closed
lilyball opened this Issue Mar 26, 2015 · 14 comments

Comments

Projects
None yet
9 participants
@lilyball
Copy link
Contributor

lilyball commented Mar 26, 2015

It seems like a reasonably obvious thing to do and would be trivial to implement. The only alternative right now is to always use .by_ref() before calling .take(), and that's not always viable (e.g. because the io::Take needs to be kept around without borrowing the owner of the underlying reader).

An example usage would be implementing a message-based protocol on top of a stream protocol, where the messages either have fixed-length frames or have length indicators, I might want to call .take() to be able to work with a single message and then .into_inner() when I'm done to recover the underlying reader.

@huonw

This comment has been minimized.

Copy link
Member

huonw commented Jan 8, 2016

triage: I-nominated

A lot of library types have .into_inner methods, but I'm not sure we've ever explicitly decided that we should do it for any adaptor type like this (e.g. should the various iterator adaptors get .into_inners?), especially ones like this where &mut/.by_ref work for some/most(?) cases.

@alexcrichton

This comment has been minimized.

Copy link
Member

alexcrichton commented Jan 21, 2016

triage: P-medium

@sfackler indicated that he was interested in making a PR for this and limiting it to the I/O adaptors for now.

@rust-highfive rust-highfive added P-medium and removed I-nominated labels Jan 21, 2016

@frewsxcv

This comment has been minimized.

Copy link
Member

frewsxcv commented Aug 25, 2016

@sfackler Are you still working on this? Or can I take this?

@brson brson added E-easy P-low and removed P-medium labels Aug 25, 2016

@brson

This comment has been minimized.

Copy link
Contributor

brson commented Aug 25, 2016

@frewsxcv you got it.

@frewsxcv

This comment has been minimized.

Copy link
Member

frewsxcv commented Aug 26, 2016

Opened a PR: #36019.

bors added a commit that referenced this issue Sep 13, 2016

Auto merge of #36019 - frewsxcv:take-into-inner, r=alexcrichton
Introduce `into_inner` method on `std::io::Take`.

#23755
@martinhath

This comment has been minimized.

Copy link
Contributor

martinhath commented Oct 2, 2016

Shouldn't this be closed?

@frewsxcv

This comment has been minimized.

Copy link
Member

frewsxcv commented Oct 2, 2016

Tracking issues (like this one) stay upon until the feature has stabilized. Right now, std::io::Take::into_inner is still unstable.

@sfackler

This comment has been minimized.

Copy link
Member

sfackler commented Oct 2, 2016

Looks like the #[unstable] tag isn't pointing at it though.

@frewsxcv

This comment has been minimized.

Copy link
Member

frewsxcv commented Oct 2, 2016

Yep, was just about to ping the #rust-libs channel to add the label since I can't ;)

@frewsxcv

This comment has been minimized.

Copy link
Member

frewsxcv commented Oct 3, 2016

Misread what you wrote the first time I read your comment. Added the issue number to the #[unstable] in #36916.

@alexcrichton

This comment has been minimized.

Copy link
Member

alexcrichton commented Nov 1, 2016

@rfcbot fcp merge

@rfcbot

This comment has been minimized.

Copy link

rfcbot commented Nov 1, 2016

Team member @alexcrichton has proposed to merge this. The next step is review by the rest of the tagged teams:

No concerns currently listed.

Once these reviewers reach consensus, this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up!

See this document for info about what commands tagged team members can give me.

@rfcbot

This comment has been minimized.

Copy link

rfcbot commented Nov 12, 2016

🔔 This is now entering its final comment period, as per the review above. 🔔

psst @alexcrichton, I wasn't able to add the final-comment-period label, please do so.

@rfcbot

This comment has been minimized.

Copy link

rfcbot commented Nov 22, 2016

The final comment period is now complete.

bors added a commit that referenced this issue Dec 16, 2016

Auto merge of #38369 - aturon:stab-1.15, r=alexcrichton
Library stabilizations/deprecations for 1.15 release

Stabilized:

- `std::iter::Iterator::{min_by, max_by}`
- `std::os::*::fs::FileExt`
- `std::sync::atomic::Atomic*::{get_mut, into_inner}`
- `std::vec::IntoIter::{as_slice, as_mut_slice}`
- `std::sync::mpsc::Receiver::try_iter`
- `std::os::unix::process::CommandExt::before_exec`
- `std::rc::Rc::{strong_count, weak_count}`
- `std::sync::Arc::{strong_count, weak_count}`
- `std::char::{encode_utf8, encode_utf16}`
- `std::cell::Ref::clone`
- `std::io::Take::into_inner`

Deprecated:

- `std::rc::Rc::{would_unwrap, is_unique}`
- `std::cell::RefCell::borrow_state`

Closes #23755
Closes #27733
Closes #27746
Closes #27784
Closes #28356
Closes #31398
Closes #34931
Closes #35601
Closes #35603
Closes #35918
Closes #36105

bors added a commit that referenced this issue Dec 16, 2016

Auto merge of #38369 - aturon:stab-1.15, r=alexcrichton
Library stabilizations/deprecations for 1.15 release

Stabilized:

- `std::iter::Iterator::{min_by, max_by}`
- `std::os::*::fs::FileExt`
- `std::sync::atomic::Atomic*::{get_mut, into_inner}`
- `std::vec::IntoIter::{as_slice, as_mut_slice}`
- `std::sync::mpsc::Receiver::try_iter`
- `std::os::unix::process::CommandExt::before_exec`
- `std::rc::Rc::{strong_count, weak_count}`
- `std::sync::Arc::{strong_count, weak_count}`
- `std::char::{encode_utf8, encode_utf16}`
- `std::cell::Ref::clone`
- `std::io::Take::into_inner`

Deprecated:

- `std::rc::Rc::{would_unwrap, is_unique}`
- `std::cell::RefCell::borrow_state`

Closes #23755
Closes #27733
Closes #27746
Closes #27784
Closes #28356
Closes #31398
Closes #34931
Closes #35601
Closes #35603
Closes #35918
Closes #36105

bors added a commit that referenced this issue Dec 16, 2016

Auto merge of #38369 - aturon:stab-1.15, r=alexcrichton
Library stabilizations/deprecations for 1.15 release

Stabilized:

- `std::iter::Iterator::{min_by, max_by}`
- `std::os::*::fs::FileExt`
- `std::sync::atomic::Atomic*::{get_mut, into_inner}`
- `std::vec::IntoIter::{as_slice, as_mut_slice}`
- `std::sync::mpsc::Receiver::try_iter`
- `std::os::unix::process::CommandExt::before_exec`
- `std::rc::Rc::{strong_count, weak_count}`
- `std::sync::Arc::{strong_count, weak_count}`
- `std::char::{encode_utf8, encode_utf16}`
- `std::cell::Ref::clone`
- `std::io::Take::into_inner`

Deprecated:

- `std::rc::Rc::{would_unwrap, is_unique}`
- `std::cell::RefCell::borrow_state`

Closes #23755
Closes #27733
Closes #27746
Closes #27784
Closes #28356
Closes #31398
Closes #34931
Closes #35601
Closes #35603
Closes #35918
Closes #36105

bors added a commit that referenced this issue Dec 16, 2016

Auto merge of #38369 - aturon:stab-1.15, r=alexcrichton
Library stabilizations/deprecations for 1.15 release

Stabilized:

- `std::iter::Iterator::{min_by, max_by}`
- `std::os::*::fs::FileExt`
- `std::sync::atomic::Atomic*::{get_mut, into_inner}`
- `std::vec::IntoIter::{as_slice, as_mut_slice}`
- `std::sync::mpsc::Receiver::try_iter`
- `std::os::unix::process::CommandExt::before_exec`
- `std::rc::Rc::{strong_count, weak_count}`
- `std::sync::Arc::{strong_count, weak_count}`
- `std::char::{encode_utf8, encode_utf16}`
- `std::cell::Ref::clone`
- `std::io::Take::into_inner`

Deprecated:

- `std::rc::Rc::{would_unwrap, is_unique}`
- `std::cell::RefCell::borrow_state`

Closes #23755
Closes #27733
Closes #27746
Closes #27784
Closes #28356
Closes #31398
Closes #34931
Closes #35601
Closes #35603
Closes #35918
Closes #36105

bors added a commit that referenced this issue Dec 18, 2016

Auto merge of #38369 - aturon:stab-1.15, r=alexcrichton
Library stabilizations/deprecations for 1.15 release

Stabilized:

- `std::iter::Iterator::{min_by, max_by}`
- `std::os::*::fs::FileExt`
- `std::sync::atomic::Atomic*::{get_mut, into_inner}`
- `std::vec::IntoIter::{as_slice, as_mut_slice}`
- `std::sync::mpsc::Receiver::try_iter`
- `std::os::unix::process::CommandExt::before_exec`
- `std::rc::Rc::{strong_count, weak_count}`
- `std::sync::Arc::{strong_count, weak_count}`
- `std::char::{encode_utf8, encode_utf16}`
- `std::cell::Ref::clone`
- `std::io::Take::into_inner`

Deprecated:

- `std::rc::Rc::{would_unwrap, is_unique}`
- `std::cell::RefCell::borrow_state`

Closes #23755
Closes #27733
Closes #27746
Closes #27784
Closes #28356
Closes #31398
Closes #34931
Closes #35601
Closes #35603
Closes #35918
Closes #36105

bors added a commit that referenced this issue Dec 18, 2016

Auto merge of #38369 - aturon:stab-1.15, r=alexcrichton
Library stabilizations/deprecations for 1.15 release

Stabilized:

- `std::iter::Iterator::{min_by, max_by}`
- `std::os::*::fs::FileExt`
- `std::sync::atomic::Atomic*::{get_mut, into_inner}`
- `std::vec::IntoIter::{as_slice, as_mut_slice}`
- `std::sync::mpsc::Receiver::try_iter`
- `std::os::unix::process::CommandExt::before_exec`
- `std::rc::Rc::{strong_count, weak_count}`
- `std::sync::Arc::{strong_count, weak_count}`
- `std::char::{encode_utf8, encode_utf16}`
- `std::cell::Ref::clone`
- `std::io::Take::into_inner`

Deprecated:

- `std::rc::Rc::{would_unwrap, is_unique}`
- `std::cell::RefCell::borrow_state`

Closes #23755
Closes #27733
Closes #27746
Closes #27784
Closes #28356
Closes #31398
Closes #34931
Closes #35601
Closes #35603
Closes #35918
Closes #36105

@bors bors closed this in #38369 Dec 18, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.