Skip to content

πŸ”– zbus 4.0.0

Compare
Choose a tag to compare
@github-actions github-actions released this 12 Feb 19:33
· 1135 commits to main since this release
25876f3

A new API-breaking release that brings in a huge amount of changes. Most using code should still
compile (with deprecation warnings) and work without changes. Hightlights:

  • 🚚 Changing names of dbus_interface and dbus_proxy along with their atrributes. See
    zbus_macros release notes for details, including commands to automatically update your
    code.
  • πŸ‘½οΈ Adapt to zvariant 4.0 changes.
  • 🚚 Make use of submodules for nicer API hierarchy. In most cases
    deprecation warnings will guide you to the new paths.
  • 🚚 XML parsing API split into a separate crate, zbus_xml. The xml
    and quick-xml feature flags are removed as a result. #413.
  • πŸ—οΈ Message API overhaul
    • 🚸 header method and message::Header getters now infallible.
    • 🏷️ body method now returns a new type, message::Body that provides all message body-related API.
    • πŸ”₯ MessageField* API dropped. Use Message::header() with message::Header's specific getters.
    • πŸ”₯ message::Type::Invalid variant dropped. We just don't let a message be created for invalid types.
    • 🚚 as_bytes method renamed to data and now returns &zvariant::serialized::Data.
    • πŸ”₯ Drop Message::take_fds() method. This was never a good idea because it is basically
      unsafe (even though it's not marked as such) since it disassociates the FDs from the message and
      the caller is free to close them while message is still referencing them.
    • 🏷️ All serial number related API now use NonZeroU32.
    • 🚸 constructors now return a Builder instance.
    • 🚸 Arc wrapping of message no longer needed and all API using Arc type now use Message.
    • πŸ”₯ Drop unneeded From for message::Type.
  • πŸ”Œ Connection
    • πŸ”₯ Drop futures::Sink implementation. This was proving very difficult to maintain and most
      likely used by very few people, who can use the send method instead.
    • 🏷️ server_guid return &Guid now, instead of a string.
    • πŸ₯… connection::Builder::server now takes anything TryInto and hence fallible.
    • πŸ₯… connection::Builder ensures GUID is correct for client: If the client connection is
      constructed through an address with GUID in it, we should verify this GUID is the same as one
      received from the server during the handshake.
    • πŸ—οΈ Socket trait now higher-level, async and split into read and write
      halves.
    • πŸ”₯ Remove unnecessary constraints on Socket. and associated types.
    • ✨ Add missing blocking::connection::Builder::socket.
    • ✨ Proper support for abstract unix sockets that makes use of the std API. This replaces our hack.
  • πŸ’₯ Split Guid into reference & owned types. Guid now has a lifetime parameter, and
    OwnedGuid is a new type that's a wrapper around Guid<'static>. Internally, Guid is now a
    wrapper around zvariant::Str and is now a very similar type to other zvariant::Str wrapper
    types.
  • πŸ—οΈ Address API overhaul:
    • πŸ’₯ Split transport bits into a separate type hierarchy, address::Transport. Address` is
      no longer an enum but a struct with hidden fields. #476.
    • ✨ Support GUIDs. We previously just ignored GUIDs in addresses. No more. We now parse it, if
      present and provide API to set a GUID on an Address instance.
    • ✨ Support unix:tmpdir and unix:dir transports.
    • πŸ› Fix Display impl for address of abstract Unix sockets.
  • ✨ Relax type bound on Proxy::call/call_with_flags. A bound of
    for<'d> zvariant::DynamicDeserialize<'d> on the result type of a call is sufficient to
    deserialize; use this bound instead of the stricter DeserializeOwned + zvariant::Type.
  • πŸ—‘οΈ Some APIs deprecated (the deprecation warnings will give a hint).
  • πŸ”₯ Drop Error::NoBodySignature variant
  • πŸ”₯ Drop Deprecated APIs.
  • 🚩 Gate all p2p API behind a p2p feature. Given that typical users do not need this API, we don't enable it by default.
  • 🚩 Add bus-impl cargo feature. API that is only needed by bus implementations now gated behind this non-default cargo feature. #480.
    the peer-to-peer and bus implementation API respectively.
  • ⬆️ Migrate from winapi to windows-sys (#534).
  • ⬆️ Dependencies bumped
    • event-listener 5.0.
    • async-broadcast 0.7.0.
    • async-process 2.0.
    • async-io 2.0.
    • async-lock 3.0.
    • async-fs 2.0.
    • vsock 0.4.
    • tokio-vsock 0.4.
    • nix 0.27.
  • βž– Dependencies dropped
    • once_cell
    • byteorder. Use endi crate instead through zvariant.
    • async-recursion for targets other than MacOS and Windows.
  • ⬆️ Bump MSRV to 1.75
  • πŸ”§ Switch to Rust 2021. This doesn't affect our users but gives us some features.
  • 🩹 implement peer_credentials() for tokio win32.
  • πŸ“Œ Pin tokio to only its major version. This allows it to be upgraded to any API-compatible versions.
  • πŸš‘οΈ Don't send ObjectManager signals before Hello method.
  • πŸš‘οΈ Fix a pointer access on Windows. Details at: microsoft/windows-rs#2842
  • πŸš‘οΈ Fix use-after-free in Windows SID code.
  • πŸ”₯ Don't assume defaults in fdo interfaces. Otherwise people will forget to set them and then wonder why their code is not working.
  • πŸ’₯ Drop Deref impl for blocking::ObjectServer. Not exactly a smart pointer. Also other blocking wrappers don't do that. #475.
  • ✨ Support non-native endian:
    • Respond to messages using the same endian. This makes sense and it's also what gdbus does.
    • Add message::Builder::endian. This allows one to specify the endianness of the message they're constructing.
  • πŸ“ book: Add a simpler D-Bus signals example.
  • πŸ› Use the correct traversal order for node tree introspection in ObjectServer.
  • πŸ’₯ Serial numbers now globally assigned to messages, instead of Connection managing the serial numbers.
  • 🚩 Add option-as-array feature. This is a mainly a zvariant proxy/forwarding feature.
  • 🚩 Remove unused gvariant feature. zbus doesn't actually make use of this even if it was
    enabled. This only causes confusion if user enables it since then Option<T> has zvariant::Type
    implemented but D-Bus encoding doesn't support that and people get runtime errors instead.
  • 🩹 Server connection should reject fd-passing if not possible. If the client asks for
    fd-passing on socket type that doesn't support it, reject the request.
  • πŸ’₯ Make interface arg on fdo::PropertiesProxy::get_all optional. This is as per the specs. #302.
  • πŸ—‘οΈ Deprecate proxy::Builder::new_bare method. In favor of proxy::Builder::new(), which
    new_bare is just a wrapper around now, since all proxy types implement ProxyDefault trait. #417.
  • ✨ impl ProxyDefault for Proxy.
  • πŸ—οΈ ProxyDefault's constants now optional. This makes things a bit simpler and streamlined by
    allowing all generated proxies to implement this trait.
  • ✨ Add ProxyImpl trait that macro-generated proxies implement. It makes it possible to write
    generic code around different proxy types. #433
  • 🩹 fdo proxies now don't assume default service and paths.
  • ⚑️ Some optimizations.
  • πŸ”Š add some logging to handshake code.
  • πŸ“ hide ResultAdapter from the doc, it's internal helper API.
  • 🎨 Fix formatting of Cargo.toml file.