Skip to content

Commit 713b756

Browse files
committed
Update ControlMessages* based on implementation PR
1 parent 5cb2f2e commit 713b756

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

text/3430-unix-socket-ancillary-data-v2.md

+9-5
Original file line numberDiff line numberDiff line change
@@ -166,12 +166,12 @@ inspected and iterated over to obtain `ControlMessage` values.
166166

167167

168168
```rust
169-
struct ControlMessages;
169+
struct ControlMessages { ... };
170170

171171
impl ControlMessages {
172+
fn from_bytes(bytes: &[u8]) -> &ControlMessages;
172173
fn as_bytes(&self) -> &[u8];
173174
fn is_empty(&self) -> bool;
174-
fn len(&self) -> usize;
175175
fn iter(&self) -> ControlMessagesIter<'_>;
176176
}
177177

@@ -185,6 +185,11 @@ struct ControlMessagesIter<'a> { ... }
185185
impl<'a> Iterator for ControlMessagesIter<'a> {
186186
type Item = ControlMessage<'a>;
187187
}
188+
189+
impl ControlMessagesIter<'a> {
190+
// For inspecting non-iterable fragment in truncated buffer.
191+
fn into_bytes(self) -> &'a [u8];
192+
}
188193
```
189194

190195
A `ControlMessagesBuf` is the owned variant of `ControlMessages`. It exposes a
@@ -201,8 +206,7 @@ impl ControlMessagesBuf {
201206

202207
fn capacity(&self) -> usize;
203208

204-
fn push(&mut self, message: &ControlMessage<'_>);
205-
fn extend_from_slice(&mut self, messages: &[ControlMessage<'_>]);
209+
fn push(&mut self, message: impl Into<ControlMessage<'_>>);
206210

207211
fn reserve(&mut self, additional: usize);
208212

@@ -220,7 +224,6 @@ impl ControlMessagesBuf {
220224
}
221225

222226
impl AsRef<ControlMessages> for ControlMessagesBuf;
223-
impl AsMut<ControlMessages> for ControlMessagesBuf;
224227

225228
impl Deref for ControlMessagesBuf {
226229
type Target = ControlMessages;
@@ -233,6 +236,7 @@ impl<'a> IntoIterator for &'a ControlMessagesBuf {
233236
}
234237

235238
impl Extend<ControlMessage<'_>> for ControlMessagesBuf;
239+
impl Extend<&ControlMessage<'_>> for ControlMessagesBuf;
236240
```
237241

238242
## Ancillary data

0 commit comments

Comments
 (0)