aboutsummaryrefslogtreecommitdiff
path: root/crates/whirl_server/src/net
diff options
context:
space:
mode:
authorFuwn <[email protected]>2021-06-06 21:00:22 +0000
committerFuwn <[email protected]>2021-06-06 21:00:22 +0000
commit63df0a38c946f577066604e303f40e3b17073674 (patch)
tree604d7f5e68788c9c2b9937eb39d230d7085450db /crates/whirl_server/src/net
parentrefactor(whirl_server): move orphan types out of orphan module (diff)
downloadwhirl-63df0a38c946f577066604e303f40e3b17073674.tar.xz
whirl-63df0a38c946f577066604e303f40e3b17073674.zip
docs(whirl_server): document more public functions
Diffstat (limited to 'crates/whirl_server/src/net')
-rw-r--r--crates/whirl_server/src/net/property_list.rs8
1 files changed, 6 insertions, 2 deletions
diff --git a/crates/whirl_server/src/net/property_list.rs b/crates/whirl_server/src/net/property_list.rs
index 4bba6c7..c91408b 100644
--- a/crates/whirl_server/src/net/property_list.rs
+++ b/crates/whirl_server/src/net/property_list.rs
@@ -14,6 +14,7 @@ use crate::{
pub struct PropertyList(pub Vec<crate::net::network_property::NetworkProperty>);
impl PropertyList {
+ /// Convert a `PropertyList` to a ready-to-be sent command.
pub fn as_bytes(&mut self, command_id: i32, obj_id: i32) -> Vec<u8> {
let mut command = BytesMut::new();
let property_list = &mut self.0;
@@ -56,12 +57,15 @@ impl PropertyList {
command_as_vec
}
+ /// Find and return a reference to a `NetworkProperty` within the associated
+ /// `PropertyList`.
pub fn find(&self, property: i32) -> &NetworkProperty {
self.0.iter().find(|i| i.prop_id == property).unwrap()
}
- /// Iterate over a network property in the form of bytes (Vec<u8>) and return
- /// a list of human-readable properties.
+ /// Iterate over a property list in it's original, encoded, byte form
+ /// (`Vec<u8>`), and return a list of human-readable network properties
+ /// (`PropertyList`).
pub fn from_bytes(mut data: Vec<u8>) -> Self {
let mut property_list = vec![];