summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSunil Nimmagadda <sunil@nimmagadda.net>2025-11-08 14:15:00 +0530
committerSunil Nimmagadda <sunil@nimmagadda.net>2025-11-08 14:15:00 +0530
commitdf54f93717b0bc701878f34b753228547a2a8479 (patch)
tree3b5f6994d3aa000e3dc8e28bdbcfe0c50a87fb12 /src
parent0d00405fd4b5ed4a3759c7ae122058bc7adbbddd (diff)
Simplify return value.HEADmain
Moved away from cursor in commit 55c770ca23575 and wrote directly to a Vec. No more IO happening and needn't return a Result.
Diffstat (limited to 'src')
-rw-r--r--src/vrrpv2.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/vrrpv2.rs b/src/vrrpv2.rs
index 57f692a..b42cba0 100644
--- a/src/vrrpv2.rs
+++ b/src/vrrpv2.rs
@@ -83,7 +83,7 @@ pub enum AuthType {
}
impl VRRPv2 {
- pub fn to_bytes(&self) -> Result<Vec<u8>, std::io::Error> {
+ pub fn to_bytes(&self) -> Vec<u8> {
let sz = MIN_PACKET_SIZE + (self.ip_addrs.len() * 4);
let mut bytes: Vec<u8> = Vec::with_capacity(sz);
bytes.push(VERSION_TYPE);
@@ -101,7 +101,7 @@ impl VRRPv2 {
let cksum_bytes = cksum.to_be_bytes();
bytes[6] = cksum_bytes[0];
bytes[7] = cksum_bytes[1];
- Ok(bytes)
+ bytes
}
}
@@ -303,6 +303,6 @@ fn test_to_bytes() {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
];
let vrrpv2 = from_bytes(&in_bytes).expect("parsing failed");
- let out_bytes = vrrpv2.to_bytes().expect("conversion failed");
+ let out_bytes = vrrpv2.to_bytes();
assert_eq!(in_bytes.as_ref(), out_bytes);
}