Skip to content

Commit

Permalink
➖ zb: Drop now unneeded direct dep on endi
Browse files Browse the repository at this point in the history
Use its API through `zvariant` instead.
  • Loading branch information
zeenix committed Dec 13, 2023
1 parent 6a958ea commit 254902c
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 10 deletions.
1 change: 0 additions & 1 deletion zbus/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ vsock = ["dep:vsock", "dep:async-io"]
tokio-vsock = ["dep:tokio-vsock", "tokio"]

[dependencies]
endi = "1.1.0"
serde = { version = "1.0", features = ["derive"] }
serde_repr = "0.1.9"
zvariant = { path = "../zvariant", version = "4.0.0", default-features = false, features = [
Expand Down
2 changes: 1 addition & 1 deletion zbus/src/connection/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1305,10 +1305,10 @@ enum NameStatus {

#[cfg(test)]
mod tests {
use endi::{Endian, NATIVE_ENDIAN};
use futures_util::stream::TryStreamExt;
use ntest::timeout;
use test_log::test;
use zvariant::{Endian, NATIVE_ENDIAN};

use crate::{fdo::DBusProxy, AuthMechanism};

Expand Down
7 changes: 5 additions & 2 deletions zbus/src/connection/socket_reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@ use std::{collections::HashMap, sync::Arc};

use event_listener::Event;
use tracing::{debug, instrument, trace};
use zvariant::serialized::{self, Context};
use zvariant::{
serialized::{self, Context},
Endian,
};

use crate::{
async_lock::Mutex,
Expand Down Expand Up @@ -180,7 +183,7 @@ impl SocketReader {
// If we reach here, the message is complete; return it
let seq = self.prev_seq + 1;
self.prev_seq = seq;
let endian = endi::Endian::from(primary_header.endian_sig());
let endian = Endian::from(primary_header.endian_sig());
let ctxt = Context::new_dbus(endian, 0);
#[cfg(unix)]
let bytes = serialized::Data::new_fds(bytes, ctxt, fds);
Expand Down
4 changes: 2 additions & 2 deletions zbus/src/message/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use std::{

use enumflags2::BitFlags;
use zbus_names::{BusName, ErrorName, InterfaceName, MemberName, UniqueName};
use zvariant::serialized;
use zvariant::{serialized, Endian};

use crate::{
message::{Field, FieldCode, Fields, Flags, Header, Message, PrimaryHeader, Sequence, Type},
Expand Down Expand Up @@ -191,7 +191,7 @@ impl<'a> Builder<'a> {
/// Set the endianness of the message.
///
/// The default endianness is native.
pub fn endian(mut self, endian: endi::Endian) -> Self {
pub fn endian(mut self, endian: Endian) -> Self {
let sig = EndianSig::from(endian);
self.header.primary_mut().set_endian_sig(sig);

Expand Down
3 changes: 1 addition & 2 deletions zbus/src/message/header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ use std::{
sync::atomic::{AtomicU32, Ordering::SeqCst},
};

use endi::Endian;
use enumflags2::{bitflags, BitFlags};
use serde::{Deserialize, Serialize};
use serde_repr::{Deserialize_repr, Serialize_repr};
Expand All @@ -12,7 +11,7 @@ use static_assertions::assert_impl_all;
use zbus_names::{BusName, ErrorName, InterfaceName, MemberName, UniqueName};
use zvariant::{
serialized::{self, Context},
ObjectPath, Signature, Type as VariantType,
Endian, ObjectPath, Signature, Type as VariantType,
};

use crate::{
Expand Down
4 changes: 2 additions & 2 deletions zbus/src/message/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::{fmt, num::NonZeroU32, sync::Arc};

use static_assertions::assert_impl_all;
use zbus_names::{ErrorName, InterfaceName, MemberName};
use zvariant::serialized;
use zvariant::{serialized, Endian};

use crate::{utils::padding_for_8_bytes, zvariant::ObjectPath, Error, Result};

Expand Down Expand Up @@ -133,7 +133,7 @@ impl Message {
bytes: serialized::Data<'static, 'static>,
recv_seq: u64,
) -> Result<Self> {
let endian = endi::Endian::from(EndianSig::try_from(bytes[0])?);
let endian = Endian::from(EndianSig::try_from(bytes[0])?);
if endian != bytes.context().endian() {
return Err(Error::IncorrectEndian);
}
Expand Down

0 comments on commit 254902c

Please sign in to comment.