Changed name to XmppCodec

Parker created

Change summary

tokio-xmpp/examples/echo_server.rs |  4 ++--
tokio-xmpp/src/lib.rs              |  2 +-
tokio-xmpp/src/stream_start.rs     |  4 ++--
tokio-xmpp/src/xmpp_codec.rs       | 26 +++++++++++++-------------
tokio-xmpp/src/xmpp_stream.rs      |  8 ++++----
5 files changed, 22 insertions(+), 22 deletions(-)

Detailed changes

tokio-xmpp/examples/echo_server.rs 🔗

@@ -2,7 +2,7 @@ use futures::{SinkExt, StreamExt};
 use tokio::{self, io, net::TcpSocket};
 use tokio_util::codec::Framed;
 
-use tokio_xmpp::XMPPCodec;
+use tokio_xmpp::XmppCodec;
 
 #[tokio::main]
 async fn main() -> Result<(), io::Error> {
@@ -18,7 +18,7 @@ async fn main() -> Result<(), io::Error> {
         let (stream, _addr) = listener.accept().await?;
 
         // Use the `XMPPCodec` to encode and decode frames
-        let mut framed = Framed::new(stream, XMPPCodec::new());
+        let mut framed = Framed::new(stream, XmppCodec::new());
 
         tokio::spawn(async move {
             while let Some(packet) = framed.next().await {

tokio-xmpp/src/lib.rs 🔗

@@ -25,7 +25,7 @@ mod stream_start;
 #[cfg(feature = "insecure-tcp")]
 pub mod tcp;
 mod xmpp_codec;
-pub use crate::xmpp_codec::{Packet, XMPPCodec};
+pub use crate::xmpp_codec::{Packet, XmppCodec};
 mod event;
 pub use event::Event;
 mod client;

tokio-xmpp/src/stream_start.rs 🔗

@@ -3,14 +3,14 @@ use tokio::io::{AsyncRead, AsyncWrite};
 use tokio_util::codec::Framed;
 use xmpp_parsers::{ns, Element, Jid};
 
-use crate::xmpp_codec::{Packet, XMPPCodec};
+use crate::xmpp_codec::{Packet, XmppCodec};
 use crate::xmpp_stream::XMPPStream;
 use crate::{Error, ProtocolError};
 
 /// Sends a `<stream:stream>`, then wait for one from the server, and
 /// construct an XMPPStream.
 pub async fn start<S: AsyncRead + AsyncWrite + Unpin>(
-    mut stream: Framed<S, XMPPCodec>,
+    mut stream: Framed<S, XmppCodec>,
     jid: Jid,
     ns: String,
 ) -> Result<XMPPStream<S>, Error> {

tokio-xmpp/src/xmpp_codec.rs 🔗

@@ -59,7 +59,7 @@ pub enum Packet {
 }
 
 /// Stateful encoder/decoder for a bytestream from/to XMPP `Packet`
-pub struct XMPPCodec {
+pub struct XmppCodec {
     /// Outgoing
     ns: Option<String>,
     /// Incoming
@@ -67,7 +67,7 @@ pub struct XMPPCodec {
     stanza_builder: TreeBuilder,
 }
 
-impl XMPPCodec {
+impl XmppCodec {
     /// Constructor
     pub fn new() -> Self {
         let stanza_builder = TreeBuilder::new();
@@ -76,7 +76,7 @@ impl XMPPCodec {
         if log::log_enabled!(log::Level::Debug) && PS.get().is_none() {
             init_syntect();
         }
-        XMPPCodec {
+        XmppCodec {
             ns: None,
             driver,
             stanza_builder,
@@ -84,13 +84,13 @@ impl XMPPCodec {
     }
 }
 
-impl Default for XMPPCodec {
+impl Default for XmppCodec {
     fn default() -> Self {
         Self::new()
     }
 }
 
-impl Decoder for XMPPCodec {
+impl Decoder for XmppCodec {
     type Item = Packet;
     type Error = Error;
 
@@ -149,7 +149,7 @@ impl Decoder for XMPPCodec {
     }
 }
 
-impl Encoder<Packet> for XMPPCodec {
+impl Encoder<Packet> for XmppCodec {
     type Error = Error;
 
     fn encode(&mut self, item: Packet, dst: &mut BytesMut) -> Result<(), Self::Error> {
@@ -253,7 +253,7 @@ mod tests {
 
     #[test]
     fn test_stream_start() {
-        let mut c = XMPPCodec::new();
+        let mut c = XmppCodec::new();
         let mut b = BytesMut::with_capacity(1024);
         b.put_slice(b"<?xml version='1.0'?><stream:stream xmlns:stream='http://etherx.jabber.org/streams' version='1.0' xmlns='jabber:client'>");
         let r = c.decode(&mut b);
@@ -265,7 +265,7 @@ mod tests {
 
     #[test]
     fn test_stream_end() {
-        let mut c = XMPPCodec::new();
+        let mut c = XmppCodec::new();
         let mut b = BytesMut::with_capacity(1024);
         b.put_slice(b"<?xml version='1.0'?><stream:stream xmlns:stream='http://etherx.jabber.org/streams' version='1.0' xmlns='jabber:client'>");
         let r = c.decode(&mut b);
@@ -283,7 +283,7 @@ mod tests {
 
     #[test]
     fn test_truncated_stanza() {
-        let mut c = XMPPCodec::new();
+        let mut c = XmppCodec::new();
         let mut b = BytesMut::with_capacity(1024);
         b.put_slice(b"<?xml version='1.0'?><stream:stream xmlns:stream='http://etherx.jabber.org/streams' version='1.0' xmlns='jabber:client'>");
         let r = c.decode(&mut b);
@@ -309,7 +309,7 @@ mod tests {
 
     #[test]
     fn test_truncated_utf8() {
-        let mut c = XMPPCodec::new();
+        let mut c = XmppCodec::new();
         let mut b = BytesMut::with_capacity(1024);
         b.put_slice(b"<?xml version='1.0'?><stream:stream xmlns:stream='http://etherx.jabber.org/streams' version='1.0' xmlns='jabber:client'>");
         let r = c.decode(&mut b);
@@ -336,7 +336,7 @@ mod tests {
     /// test case for https://gitlab.com/xmpp-rs/tokio-xmpp/issues/3
     #[test]
     fn test_atrribute_prefix() {
-        let mut c = XMPPCodec::new();
+        let mut c = XmppCodec::new();
         let mut b = BytesMut::with_capacity(1024);
         b.put_slice(b"<?xml version='1.0'?><stream:stream xmlns:stream='http://etherx.jabber.org/streams' version='1.0' xmlns='jabber:client'>");
         let r = c.decode(&mut b);
@@ -363,7 +363,7 @@ mod tests {
         use futures::{executor::block_on, sink::SinkExt};
         use std::io::Cursor;
         use tokio_util::codec::FramedWrite;
-        let mut framed = FramedWrite::new(Cursor::new(vec![]), XMPPCodec::new());
+        let mut framed = FramedWrite::new(Cursor::new(vec![]), XmppCodec::new());
         let mut text = "".to_owned();
         for _ in 0..2usize.pow(15) {
             text = text + "A";
@@ -388,7 +388,7 @@ mod tests {
 
     #[test]
     fn test_cut_out_stanza() {
-        let mut c = XMPPCodec::new();
+        let mut c = XmppCodec::new();
         let mut b = BytesMut::with_capacity(1024);
         b.put_slice(b"<?xml version='1.0'?><stream:stream xmlns:stream='http://etherx.jabber.org/streams' version='1.0' xmlns='jabber:client'>");
         let r = c.decode(&mut b);

tokio-xmpp/src/xmpp_stream.rs 🔗

@@ -11,7 +11,7 @@ use xmpp_parsers::{Element, Jid};
 
 use crate::stream_features::StreamFeatures;
 use crate::stream_start;
-use crate::xmpp_codec::{Packet, XMPPCodec};
+use crate::xmpp_codec::{Packet, XmppCodec};
 use crate::Error;
 
 fn make_id() -> String {
@@ -40,7 +40,7 @@ pub struct XMPPStream<S: AsyncRead + AsyncWrite + Unpin> {
     /// The local Jabber-Id
     pub jid: Jid,
     /// Codec instance
-    pub stream: Framed<S, XMPPCodec>,
+    pub stream: Framed<S, XmppCodec>,
     /// `<stream:features/>` for XMPP version 1.0
     pub stream_features: StreamFeatures,
     /// Root namespace
@@ -56,7 +56,7 @@ impl<S: AsyncRead + AsyncWrite + Unpin> XMPPStream<S> {
     /// Constructor
     pub fn new(
         jid: Jid,
-        stream: Framed<S, XMPPCodec>,
+        stream: Framed<S, XmppCodec>,
         ns: String,
         id: String,
         stream_features: Element,
@@ -72,7 +72,7 @@ impl<S: AsyncRead + AsyncWrite + Unpin> XMPPStream<S> {
 
     /// Send a `<stream:stream>` start tag
     pub async fn start(stream: S, jid: Jid, ns: String) -> Result<Self, Error> {
-        let xmpp_stream = Framed::new(stream, XMPPCodec::new());
+        let xmpp_stream = Framed::new(stream, XmppCodec::new());
         stream_start::start(xmpp_stream, jid, ns).await
     }