Struct NotifyFd

Source
pub struct NotifyFd { /* private fields */ }
Available on crate features std and libc only.
Expand description

A socket, communicating with systemd.

See man sd_notify for general information on the kind of notifications that can be sent to the service manager. Note that there’s generally no feedback as described by the man page. The errors indicate whether the OS interactions failed, not whether any of the messages have been interpreted or resulted in success.

Implementations§

Source§

impl NotifyFd

Source

pub fn new() -> Option<Result<Self, Error>>

Open the notification socket, if configured in the environment.

Source

pub fn from_env(name: OsString) -> Result<Self, Error>

Open the socket named by the environment string.

This should be generally used with the contents of $NOTIFY_SOCKET. The string is interpreted based on the supported protocol and the first character, as described in the systemd documentation. Note that there’s a maximum sensible length for the path named by this environment variable, as per libc::sockaddr_un.

Source

pub fn notify_with_fds(self, state: &str, fds: &[RawFd]) -> Result<(), Error>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.