Skip to content

Commit f72086a

Browse files
committed
Rename PacketList::length -> len
This is consistent with the naming in Rust's standard library.
1 parent 07983d5 commit f72086a

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/packets.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,15 +100,15 @@ impl PacketList {
100100

101101
/// Get the number of packets in the list.
102102
///
103-
pub fn length(&self) -> usize {
103+
pub fn len(&self) -> usize {
104104
self.inner.num_packets as usize
105105
}
106106

107107
/// Get an iterator for the packets in the list.
108108
///
109109
pub fn iter<'a>(&'a self) -> PacketListIterator<'a> {
110110
PacketListIterator {
111-
count: self.length(),
111+
count: self.len(),
112112
packet_ptr: self.inner.data.as_ptr(),
113113
_phantom: ::std::marker::PhantomData::default(),
114114
}
@@ -447,7 +447,7 @@ mod tests {
447447
packet_buf.push_packet(43, &[0x91u8, 0x40, 0x7f]);
448448
packet_buf.push_packet(44, &[0x80u8, 0x40, 0x7f]);
449449
packet_buf.push_packet(45, &[0x81u8, 0x40, 0x7f]);
450-
assert_eq!(packet_buf.length(), 4);
450+
assert_eq!(packet_buf.len(), 4);
451451
}
452452

453453
#[test]
@@ -560,7 +560,7 @@ mod tests {
560560
let list: &PacketList = &packet_buf;
561561

562562
// check if the contents match
563-
assert_eq!(list_native.length(), list.length(), "PacketList lenghts must match");
563+
assert_eq!(list_native.len(), list.len(), "PacketList lengths must match");
564564
for (n, p) in list_native.iter().zip(list.iter()) {
565565
assert_eq!(n.data(), p.data());
566566
}

0 commit comments

Comments
 (0)