Skip to content

Commit

Permalink
🚚 zb: Move AuthMechanism from crate root to conn
Browse files Browse the repository at this point in the history
We leave the `AuthMechanism` in the root as deprecated.
  • Loading branch information
zeenix committed Oct 4, 2024
1 parent 23bda8e commit b7be906
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 13 deletions.
5 changes: 3 additions & 2 deletions zbus/src/blocking/connection/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ use zvariant::ObjectPath;
#[cfg(feature = "p2p")]
use crate::Guid;
use crate::{
address::ToAddresses, blocking::Connection, connection::socket::BoxedSplit,
names::WellKnownName, object_server::Interface, utils::block_on, AuthMechanism, Error, Result,
address::ToAddresses, blocking::Connection, conn::AuthMechanism,
connection::socket::BoxedSplit, names::WellKnownName, object_server::Interface,
utils::block_on, Error, Result,
};

/// A builder for [`zbus::blocking::Connection`].
Expand Down
2 changes: 1 addition & 1 deletion zbus/src/connection/handshake/command.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::{fmt, str::FromStr};

use crate::{AuthMechanism, Error, Guid, OwnedGuid, Result};
use crate::{conn::AuthMechanism, Error, Guid, OwnedGuid, Result};

// The plain-text SASL profile authentication protocol described here:
// <https://dbus.freedesktop.org/doc/dbus-specification.html#auth-protocol>
Expand Down
3 changes: 2 additions & 1 deletion zbus/src/connection/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ mod socket_reader;
use socket_reader::SocketReader;

pub(crate) mod handshake;
pub use handshake::AuthMechanism;
use handshake::Authenticated;

mod connect;
Expand Down Expand Up @@ -1528,7 +1529,7 @@ mod p2p_tests {
use test_log::test;
use zvariant::{Endian, NATIVE_ENDIAN};

use crate::{AuthMechanism, Guid};
use crate::{conn::AuthMechanism, Guid};

use super::*;

Expand Down
2 changes: 1 addition & 1 deletion zbus/src/connection/socket/channel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::io;

use async_broadcast::{broadcast, Receiver, Sender};

use crate::{fdo::ConnectionCredentials, AuthMechanism, Message};
use crate::{conn::AuthMechanism, fdo::ConnectionCredentials, Message};

/// An in-process channel-based socket.
///
Expand Down
3 changes: 2 additions & 1 deletion zbus/src/connection/socket/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,13 @@ use std::{io, mem};
use tracing::trace;

use crate::{
conn::AuthMechanism,
fdo::ConnectionCredentials,
message::{
header::{MAX_MESSAGE_SIZE, MIN_MESSAGE_SIZE},
PrimaryHeader,
},
padding_for_8_bytes, AuthMechanism, Message,
padding_for_8_bytes, Message,
};
#[cfg(unix)]
use std::os::fd::{AsFd, BorrowedFd, OwnedFd};
Expand Down
8 changes: 4 additions & 4 deletions zbus/src/connection/socket/tcp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ impl ReadHalf for Arc<Async<TcpStream>> {
}

#[cfg(not(windows))]
fn auth_mechanism(&self) -> crate::AuthMechanism {
crate::AuthMechanism::Anonymous
fn auth_mechanism(&self) -> crate::conn::AuthMechanism {
crate::conn::AuthMechanism::Anonymous
}
}

Expand Down Expand Up @@ -127,8 +127,8 @@ impl ReadHalf for tokio::net::tcp::OwnedReadHalf {
}

#[cfg(not(windows))]
fn auth_mechanism(&self) -> crate::AuthMechanism {
crate::AuthMechanism::Anonymous
fn auth_mechanism(&self) -> crate::conn::AuthMechanism {
crate::conn::AuthMechanism::Anonymous
}
}

Expand Down
4 changes: 2 additions & 2 deletions zbus/src/connection/socket/vsock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ impl super::ReadHalf for tokio_vsock::ReadHalf {
})
}

fn auth_mechanism(&self) -> crate::AuthMechanism {
crate::AuthMechanism::Anonymous
fn auth_mechanism(&self) -> crate::conn::AuthMechanism {
crate::conn::AuthMechanism::Anonymous
}
}

Expand Down
7 changes: 6 additions & 1 deletion zbus/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,12 @@ pub use message::Message;
pub mod connection;
/// Alias for `connection` module, for convenience.
pub use connection as conn;
pub use connection::{handshake::AuthMechanism, Connection};
#[deprecated(
since = "5.0.0",
note = "Please use `connection::AuthMechanism` instead"
)]
pub use connection::handshake::AuthMechanism;
pub use connection::Connection;

mod message_stream;
pub use message_stream::*;
Expand Down

0 comments on commit b7be906

Please sign in to comment.