pub fn new() -> io::Result<Self> {
        #[cfg(unix)]
        {
            let socket = UnixDatagram::unbound()?;
            let sub = Self {
                socket,
                field_prefix: Some("F".into()),
            };
            // Check that we can talk to journald, by sending empty payload which journald discards.
            // However if the socket didn't exist or if none listened we'd get an error here.
            sub.send_payload(&[])?;
            Ok(sub)
        }
        #[cfg(not(unix))]
        Err(io::Error::new(
            io::ErrorKind::NotFound,
            "journald does not exist in this environment",
        ))
    }
/// Construct a journald subscriber
///
/// Fails if the journald socket couldn't be opened. Returns a `NotFound` error unconditionally
/// in non-Unix environments.
Construct a journald subscriber
Fails if the journald socket couldn't be opened. Returns a `NotFound` error unconditionally
in non-Unix environments.
Construct a journald subscriber Fails if the journald socket couldn ' t be opened . Returns a ` NotFound ` error unconditionally in non - Unix environments .
pub fn new() -> io::Result<Self> {
        #[cfg(unix)]
        {
            let socket = UnixDatagram::unbound()?;
            let sub = Self {
                socket,
                field_prefix: Some("F".into()),
            };
            // Check that we can talk to journald, by sending empty payload which journald discards.
            // However if the socket didn't exist or if none listened we'd get an error here.
            sub.send_payload(&[])?;
            Ok(sub)
        }
        #[cfg(not(unix))]
        Err(io::Error::new(
            io::ErrorKind::NotFound,
            "journald does not exist in this environment",
        ))
    }
pub fn new ( ) -> io :: Result < Self > { # [ cfg ( unix ) ] { let socket = UnixDatagram :: unbound ( ) ? ; let sub = Self { socket , field_prefix : Some ( " " . into ( ) ) , } ; // Check that we can talk to journald, by sending empty payload which journald discards. // However if the socket didn't exist or if none listened we'd get an error here. sub . send_payload ( & [ ] ) ? ; Ok ( sub ) } # [ cfg ( not ( unix ) ) ] Err ( io :: Error :: new ( io :: ErrorKind :: NotFound , " " , ) ) }
Construct a journald subscriber
Fails if the journald socket couldn't be opened.
Construct a journald subscriber Fails if the journald socket couldn ' t be opened .