Skip to main content

ServiceIdentity

Struct ServiceIdentity 

Source
pub struct ServiceIdentity { /* private fields */ }
Expand description

How this process is named as an OS service.

Combines the binary name (used by systemd and Windows), a reverse-DNS label prefix (used by launchd), and an instance discriminator (a port, an identity key, …) so one binary can run multiple service instances.

Implementations§

Source§

impl ServiceIdentity

Source

pub fn new( binary_name: BinaryName, launchd_prefix: LaunchdLabelPrefix, instance: impl Into<ServiceInstance>, ) -> Self

Describe a service instance from already-validated values.

  • binary_name — the installed binary, e.g. my-daemon;
  • launchd_prefix — the reverse-DNS launchd prefix, e.g. com.example.my-daemon;
  • instance — the per-instance suffix, e.g. an HTTP port or a node identity key. A u16 port converts directly.
Source

pub fn launchd_label(&self) -> String

The macOS launchd label: {launchd_prefix}.{instance}.

Source

pub fn systemd_unit_name(&self) -> String

The Linux systemd template-unit name: {binary_name}@{instance}.service.

Source

pub fn windows_service_name(&self) -> String

The Windows service name: {binary_name}-{instance}.

Source

pub fn service_label(&self) -> String

The service label for the platform this process runs on.

Source

pub fn detect(&self, markers: &DaemonMarkers) -> DaemonState

Full daemon detection for this identity: whether the process is a daemon and, when it is, the derived service label and system-versus-user mode.

Trait Implementations§

Source§

impl Clone for ServiceIdentity

Source§

fn clone(&self) -> ServiceIdentity

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ServiceIdentity

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for ServiceIdentity

Source§

impl PartialEq for ServiceIdentity

Source§

fn eq(&self, other: &ServiceIdentity) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for ServiceIdentity

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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.