diff options
Diffstat (limited to 'src/util.rs')
-rw-r--r-- | src/util.rs | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/src/util.rs b/src/util.rs index 186678d..6fbafe6 100644 --- a/src/util.rs +++ b/src/util.rs @@ -1,17 +1,15 @@ -use crate::endpoint::SerializeMessage; - use std::net::SocketAddr; use std::net::ToSocketAddrs; use std::pin::Pin; -use futures::Stream; - use log::info; - use serde::Serialize; +use futures::Stream; use tokio::sync::watch; +use crate::message::SerializeMessage; + /// A node's identifier, which is also its public cryptographic key pub type NodeID = sodiumoxide::crypto::sign::ed25519::PublicKey; /// A node's secret key @@ -27,7 +25,7 @@ pub type NetworkKey = sodiumoxide::crypto::auth::Key; /// /// 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 ByteStream = Pin<Box<dyn Stream<Item = Packet> + Send>>; pub type Packet = Result<Vec<u8>, u8>; @@ -38,7 +36,7 @@ pub type Packet = Result<Vec<u8>, u8>; /// This is used internally by the netapp communication protocol. pub fn rmp_to_vec_all_named<T>( val: &T, -) -> Result<(Vec<u8>, Option<AssociatedStream>), rmp_serde::encode::Error> +) -> Result<(Vec<u8>, Option<ByteStream>), rmp_serde::encode::Error> where T: SerializeMessage + ?Sized, { |