Mercurial > crates > systemd-socket
diff src/error.rs @ 28:cfef4593e207
Run `cargo fmt`.
author | Paul Fisher <paul@pfish.zone> |
---|---|
date | Sat, 19 Apr 2025 01:33:50 -0400 |
parents | 1941e9d9819c |
children |
line wrap: on
line diff
--- a/src/error.rs Fri Feb 28 23:15:59 2025 +0100 +++ b/src/error.rs Sat Apr 19 01:33:50 2025 -0400 @@ -2,10 +2,9 @@ //! //! This module separates the error types from root module to avoid clutter. - -use thiserror::Error; use std::fmt; use std::io; +use thiserror::Error; /// Error returned when the library initialization fails. #[derive(Debug)] @@ -46,13 +45,21 @@ ResolvAddr(#[from] crate::resolv_addr::ResolvAddrError), #[cfg(all(target_os = "linux", feature = "enable_systemd"))] #[error("invalid character '{c}' in systemd socket name {string} at position {pos}")] - InvalidCharacter { string: String, c: char, pos: usize, }, + InvalidCharacter { string: String, c: char, pos: usize }, #[cfg(all(target_os = "linux", feature = "enable_systemd"))] - #[error("systemd socket name {string} is {len} characters long which is more than the limit 255")] - LongSocketName { string: String, len: usize, }, + #[error( + "systemd socket name {string} is {len} characters long which is more than the limit 255" + )] + LongSocketName { string: String, len: usize }, #[cfg(not(all(target_os = "linux", feature = "enable_systemd")))] - #[cfg_attr(not(target_os = "linux"), error("can't parse {0} because systemd is not supported on this operating system"))] - #[cfg_attr(target_os = "linux", error("can't parse {0} because systemd support was disabled during build"))] + #[cfg_attr( + not(target_os = "linux"), + error("can't parse {0} because systemd is not supported on this operating system") + )] + #[cfg_attr( + target_os = "linux", + error("can't parse {0} because systemd support was disabled during build") + )] SystemdUnsupported(String), } @@ -88,9 +95,17 @@ #[derive(Debug, Error)] pub(crate) enum BindErrorInner { #[error("failed to bind {addr}")] - BindFailed { addr: std::net::SocketAddr, #[source] error: io::Error, }, + BindFailed { + addr: std::net::SocketAddr, + #[source] + error: io::Error, + }, #[error("failed to bind {addr}")] - BindOrResolvFailed { addr: crate::resolv_addr::ResolvAddr, #[source] error: io::Error, }, + BindOrResolvFailed { + addr: crate::resolv_addr::ResolvAddr, + #[source] + error: io::Error, + }, #[cfg(all(target_os = "linux", feature = "enable_systemd"))] #[error("failed to receive descriptors with names")] ReceiveDescriptors(#[source] crate::systemd_sockets::Error), @@ -129,4 +144,3 @@ #[source] pub(crate) error: io::Error, } -