Skip to content

Commit b59e6c1

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

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

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

Lines changed: 11 additions & 5 deletions
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
@@ -200,9 +205,10 @@ impl ControlMessagesBuf {
200205
fn with_capacity(capacity: usize) -> ControlMessagesBuf;
201206

202207
fn capacity(&self) -> usize;
208+
fn clear(&mut self);
203209

204-
fn push(&mut self, message: &ControlMessage<'_>);
205-
fn extend_from_slice(&mut self, messages: &[ControlMessage<'_>]);
210+
fn push(&mut self, message: impl Into<ControlMessage<'_>>);
211+
fn append(&mut self, other: &mut ControlMessagesBuf);
206212

207213
fn reserve(&mut self, additional: usize);
208214

@@ -220,7 +226,6 @@ impl ControlMessagesBuf {
220226
}
221227

222228
impl AsRef<ControlMessages> for ControlMessagesBuf;
223-
impl AsMut<ControlMessages> for ControlMessagesBuf;
224229

225230
impl Deref for ControlMessagesBuf {
226231
type Target = ControlMessages;
@@ -233,6 +238,7 @@ impl<'a> IntoIterator for &'a ControlMessagesBuf {
233238
}
234239

235240
impl Extend<ControlMessage<'_>> for ControlMessagesBuf;
241+
impl Extend<&ControlMessage<'_>> for ControlMessagesBuf;
236242
```
237243

238244
## Ancillary data

0 commit comments

Comments
 (0)