Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,10 +125,7 @@ impl Multiaddr {

/// Like [`Multiaddr::push`] but consumes `self`.
pub fn with(mut self, p: Protocol<'_>) -> Self {
let mut bytes = BytesMut::from(std::mem::take(&mut self.bytes));
p.write_bytes(&mut (&mut bytes).writer())
.expect("Writing to a `BytesMut` never fails.");
self.bytes = bytes.freeze();
self.push(p);
self
}

Expand Down Expand Up @@ -223,7 +220,7 @@ impl Multiaddr {
/// Returns &str identifiers for the protocol names themselves.
/// This omits specific info like addresses, ports, peer IDs, and the like.
/// Example: `"/ip4/127.0.0.1/tcp/5001"` would return `["ip4", "tcp"]`
pub fn protocol_stack(&self) -> ProtoStackIter {
pub fn protocol_stack(&self) -> ProtoStackIter<'_> {
ProtoStackIter { parts: self.iter() }
}
}
Expand Down