aboutsummaryrefslogtreecommitdiff
path: root/src/util.rs
diff options
context:
space:
mode:
authortrinity-1686a <trinity@deuxfleurs.fr>2022-07-18 15:21:13 +0200
committertrinity-1686a <trinity@deuxfleurs.fr>2022-07-18 15:21:13 +0200
commitcdff8ae1beab44a22d0eb0eb00c624e49971b6ca (patch)
tree1586e6042c03dd34336d4d2f2a79f1479f5e83ec /src/util.rs
parentd3d18b8e8bde5fee81022fd050d5f4c114262fcf (diff)
downloadnetapp-cdff8ae1beab44a22d0eb0eb00c624e49971b6ca.tar.gz
netapp-cdff8ae1beab44a22d0eb0eb00c624e49971b6ca.zip
add detection of premature eos
Diffstat (limited to 'src/util.rs')
-rw-r--r--src/util.rs8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/util.rs b/src/util.rs
index 76d7ecf..186678d 100644
--- a/src/util.rs
+++ b/src/util.rs
@@ -25,9 +25,11 @@ pub type NetworkKey = sodiumoxide::crypto::auth::Key;
/// When sent through Netapp, the Vec may be split in smaller chunk in such a way
/// consecutive Vec may get merged, but Vec and error code may not be reordered
///
-/// The error code have no predefined meaning, it's up to you application to define their
-/// semantic.
-pub type AssociatedStream = Pin<Box<dyn Stream<Item = Result<Vec<u8>, u8>> + Send>>;
+/// Error code 255 means the stream was cut before its end. Other codes have no predefined
+/// meaning, it's up to your application to define their semantic.
+pub type AssociatedStream = Pin<Box<dyn Stream<Item = Packet> + Send>>;
+
+pub type Packet = Result<Vec<u8>, u8>;
/// Utility function: encodes any serializable value in MessagePack binary format
/// using the RMP library.