-
Notifications
You must be signed in to change notification settings - Fork 13.8k
Open
Labels
A-ioArea: `std::io`, `std::fs`, `std::net` and `std::path`Area: `std::io`, `std::fs`, `std::net` and `std::path`C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCCategory: An issue tracking the progress of sth. like the implementation of an RFCLibs-TrackedLibs issues that are tracked on the team's project board.Libs issues that are tracked on the team's project board.O-unixOperating system: Unix-likeOperating system: Unix-likeT-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.
Description
This is a tracking issue for methods peek
and peek_from
on UnixStream
and UnixDatagram
(#73761).
The feature gate for the issue is #![feature(unix_socket_peek)]
.
Public API
impl UnixStream {
pub fn peek(&self, buf: &mut [u8]) -> io::Result<usize>
}
impl UnixDatagram {
pub fn peek(&self, buf: &mut [u8]) -> io::Result<usize>
pub fn peek_from(&self, buf: &mut [u8]) -> io::Result<(usize, SocketAddr)>
}
Steps / History
- Add
peek
andpeek_from
toUnixStream
andUnixDatagram
#73761 - initial implementationFinal Commitment Period (FCP)StabilizationTo pick up a draggable item, press the space bar. While dragging, use the arrow keys to move the item. Press space again to drop the item in its new position, or press escape to cancel.
Unresolved Questions
- None yet.
LinkTed, newAM, kirk-baird, daniel5151, kornelski and 2 more
Metadata
Metadata
Assignees
Labels
A-ioArea: `std::io`, `std::fs`, `std::net` and `std::path`Area: `std::io`, `std::fs`, `std::net` and `std::path`C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCCategory: An issue tracking the progress of sth. like the implementation of an RFCLibs-TrackedLibs issues that are tracked on the team's project board.Libs issues that are tracked on the team's project board.O-unixOperating system: Unix-likeOperating system: Unix-likeT-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.
Type
Projects
Milestone
Relationships
Development
Select code repository
Activity
daniel5151 commentedon Apr 16, 2021
Any idea when this might get stabilized?
LinkTed commentedon Aug 3, 2021
Any news?
rijenkii commentedon Jan 1, 2023
Sadly I have not been using Rust for the last year or so, and have not used this feature for even longer.
In more than two years that this feature has existed in unstable, no bugs have been reported.
Documentation is done, tests are done, I am not sure what else is needed for stabilization but it seems that it's all good.
@rust-lang/libs-api, asking for FCP.
jmillikin commentedon May 10, 2023
FYI, I wrote a draft RFC for a v2 of Unix socket ancillary data support at rust-lang/rfcs#3430. One of the features it would expose from the underlying
recv()
/recvmsg()
syscall is theMSG_PEEK
flag, which has some overlap with theunix_socket_peek
feature. It may be of interest to folks subscribed to this tracking issue.philipuvarov commentedon Aug 13, 2023
@KodrAus hey there! It looks like you were the initial reviewer for this functionality :) (sorry for ping!) What is the process for getting this out of nightly? Seems like it's been there for 3 years
kornelski commentedon Mar 29, 2024
The v2 RFC (rust-lang/rfcs#3430) proposes adding a peek option in
RecvOptions
forrecv_message()
extension trait that also requires use ofIoSliceMut
andAncillaryData
, or wrapping in and configuring aMessageReceiver
helper.I don't think these two APIs are in conflict. The advanced API is quite complex and peeking with it is a multi-step process. Even with the advanced API available, users could prefer
.peek()
for its simplicity and brevity.mmastrac commentedon May 23, 2025
There would be a lot of value in offering a basic peek method without the advanced API -- this blocks having an implementation of peek in mio, which transitively blocks tokio.
I think the
peek
method on UnixStream is pretty uncontroversial and could easily be stabilized to mirror TcpSocket.