Skip to content

Commit

Permalink
Update ControlMessages* based on implementation PR
Browse files Browse the repository at this point in the history
  • Loading branch information
jmillikin committed Oct 26, 2023
1 parent 5cb2f2e commit 713b756
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions text/3430-unix-socket-ancillary-data-v2.md
Original file line number Diff line number Diff line change
Expand Up @@ -166,12 +166,12 @@ inspected and iterated over to obtain `ControlMessage` values.


```rust
struct ControlMessages;
struct ControlMessages { ... };

impl ControlMessages {
fn from_bytes(bytes: &[u8]) -> &ControlMessages;
fn as_bytes(&self) -> &[u8];
fn is_empty(&self) -> bool;
fn len(&self) -> usize;
fn iter(&self) -> ControlMessagesIter<'_>;
}

Expand All @@ -185,6 +185,11 @@ struct ControlMessagesIter<'a> { ... }
impl<'a> Iterator for ControlMessagesIter<'a> {
type Item = ControlMessage<'a>;
}

impl ControlMessagesIter<'a> {
// For inspecting non-iterable fragment in truncated buffer.
fn into_bytes(self) -> &'a [u8];
}
```

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

fn capacity(&self) -> usize;

fn push(&mut self, message: &ControlMessage<'_>);
fn extend_from_slice(&mut self, messages: &[ControlMessage<'_>]);
fn push(&mut self, message: impl Into<ControlMessage<'_>>);

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

Expand All @@ -220,7 +224,6 @@ impl ControlMessagesBuf {
}

impl AsRef<ControlMessages> for ControlMessagesBuf;
impl AsMut<ControlMessages> for ControlMessagesBuf;

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

impl Extend<ControlMessage<'_>> for ControlMessagesBuf;
impl Extend<&ControlMessage<'_>> for ControlMessagesBuf;
```

## Ancillary data
Expand Down

0 comments on commit 713b756

Please sign in to comment.