aboutsummaryrefslogtreecommitdiff
path: root/crates/whirl_server/src/net
diff options
context:
space:
mode:
authorFuwn <[email protected]>2021-06-06 21:00:22 -0700
committerFuwn <[email protected]>2021-06-06 21:00:22 -0700
commitcf14c988ce7c76136967153644fdcff75a5437da (patch)
tree6a92f7375b37f02d30f73f2af8006941ed253664 /crates/whirl_server/src/net
parentrefactor(whirl_server): move orphan types out of orphan module (diff)
downloadwhirl-cf14c988ce7c76136967153644fdcff75a5437da.tar.xz
whirl-cf14c988ce7c76136967153644fdcff75a5437da.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![];