Skip to main content

UnitProxy

Struct UnitProxy 

pub struct UnitProxy<'p>(Proxy<'p>);
Expand description

Client for the org.freedesktop.systemd1.Unit interface of systemd.

Loaded units have objects with this interface. Get the object path from ManagerProxy::get_unit, ManagerProxy::load_unit, ManagerProxy::list_units or a job. Then create a proxy with UnitProxy::new. Each unit type adds its own interface to the object, and this crate does not cover those interfaces yet.

The methods work like the unit methods of ManagerProxy, but take no name.

§Signals and subscriptions

The service sends PropertiesChanged signals only to connections that called ManagerProxy::subscribe on their own. Call it on the connection of this proxy before the first property read, because the proxy caches the state, job, timestamp and condition properties on their first read. Keep the subscription for the lifetime of the proxy.

A reload or reexecution of the manager can change cached properties without a signal. Read the properties again or build a new proxy after the Reloading signal ends or after ManagerProxy::reexecute.

§Dependency lists

The dependency properties, such as Requires and Wants, come from the unit file and from automatic rules.

§Properties without a signal

The proxy never caches the properties that can change without a PropertiesChanged signal. It reads them from the bus on each call. Upstream marks most properties of this interface as constant, but they come from the unit file and from the other loaded units. A reload or the load of another unit can change them, for example the dependency lists, the description, the paths and the settings. These properties are not cached. Only Id, Transient and Perpetual are cached as constants. The unit file state, the preset state, Following, Markers, Refs, NeedDaemonReload and DebugInvocation change without a signal too.

Upstream documentation: https://www.freedesktop.org/software/systemd/man/latest/org.freedesktop.systemd1.html.

Tuple Fields§

§0: Proxy<'p>

Implementations§

§

impl<'p> UnitProxy<'p>

pub async fn new<P>(conn: &Connection, path: P) -> Result<UnitProxy<'p>>
where P: TryInto<ObjectPath<'p>>, P::Error: Into<Error>,

Creates a new proxy with the given path, and the default destination.

pub fn builder(conn: &Connection) -> Builder<'p, Self>

Returns a customizable builder for this proxy.

pub fn into_inner(self) -> Proxy<'p>

Consumes self, returning the underlying zbus::Proxy.

pub fn inner(&self) -> &Proxy<'p>

The reference to the underlying zbus::Proxy.

pub fn inner_mut(&mut self) -> &mut Proxy<'p>

The mutable reference to the underlying zbus::Proxy.

pub async fn start(&self, mode: &JobMode) -> Result<OwnedObjectPath>

Queues a job that starts the unit and its dependencies.

Returns the object path of the job. See ManagerProxy::start_unit for how to track the result.

pub async fn stop(&self, mode: &JobMode) -> Result<OwnedObjectPath>

Queues a job that stops the unit.

JobMode::Isolate is not valid here. Returns the object path of the job.

pub async fn reload(&self, mode: &JobMode) -> Result<OwnedObjectPath>

Queues a job that reloads the unit.

The job fails if the unit does not run. Returns the object path of the job.

pub async fn restart(&self, mode: &JobMode) -> Result<OwnedObjectPath>

Queues a job that restarts the unit.

A unit that does not run is started. Returns the object path of the job.

pub async fn try_restart(&self, mode: &JobMode) -> Result<OwnedObjectPath>

Queues a job that restarts the unit only if it runs.

Returns the object path of the job.

pub async fn reload_or_restart(&self, mode: &JobMode) -> Result<OwnedObjectPath>

Queues a job that reloads the unit if it supports reload and restarts it otherwise.

Returns the object path of the job.

pub async fn reload_or_try_restart( &self, mode: &JobMode, ) -> Result<OwnedObjectPath>

Like UnitProxy::reload_or_restart, but a unit that does not run stays as it is.

Returns the object path of the job.

pub async fn enqueue_job( &self, job_type: &JobType, job_mode: &JobMode, ) -> Result<EnqueueUnitJobReply>

Queues a job of any type for the unit.

See ManagerProxy::enqueue_unit_job for the reply.

pub async fn kill(&self, whom: &KillWhom, signal: i32) -> Result<()>

Sends a signal to processes of the unit.

pub async fn kill_subgroup(&self, subgroup: &str, signal: i32) -> Result<()>

Sends a signal to the processes in a sub control group of the unit.

The subgroup path is relative to the control group of the unit.

Added in systemd 258.

pub async fn queue_signal( &self, whom: &KillWhom, signal: i32, value: i32, ) -> Result<()>

Queues a real-time signal with an integer value for processes of the unit.

Added in systemd 254.

pub async fn reset_failed(&self) -> Result<()>

Clears the failed state of the unit.

pub async fn set_properties( &self, runtime: bool, properties: &[(&str, Value<'_>)], ) -> Result<()>

Changes properties of the unit at run time.

See ManagerProxy::set_unit_properties.

pub async fn ref_(&self) -> Result<()>

Adds a reference to the unit for this client.

This calls the Ref method. The manager keeps a referenced unit loaded. The name has a trailing underscore because ref is a Rust keyword.

pub async fn unref(&self) -> Result<()>

Removes a reference of this client to the unit.

This calls the Unref method.

pub async fn clean(&self, mask: &[CleanResource]) -> Result<()>

Deletes data of the unit, such as its state, cache or log directories.

pub async fn freeze(&self) -> Result<()>

Freezes the processes of the unit.

pub async fn thaw(&self) -> Result<()>

Thaws the processes of the unit.

pub async fn id(&self) -> Result<String>

The primary name of the unit.

pub fn cached_id( &self, ) -> Result<Option<<Result<String> as ResultAdapter>::Ok>, <Result<String> as ResultAdapter>::Err>

The primary name of the unit. Get the cached value of the Id property, or None if the property is not cached.

pub async fn names(&self) -> Result<Vec<String>>

All names of the unit, including the primary name.

pub async fn following(&self) -> Result<String>

The name of the unit whose state this unit follows, or an empty string. Some device units follow another unit, and the followed unit can change.

pub async fn requires(&self) -> Result<Vec<String>>

The units that this unit requires.

pub async fn requisite(&self) -> Result<Vec<String>>

The units that must already be active when this unit starts.

pub async fn wants(&self) -> Result<Vec<String>>

The units in the Wants= list of this unit. The list comes from the unit file and from automatic rules.

pub async fn binds_to(&self) -> Result<Vec<String>>

The units that this unit binds to. This unit stops when they stop. The list comes from the unit file and from automatic rules.

pub async fn part_of(&self) -> Result<Vec<String>>

The units that this unit is part of. The list comes from the unit file and from automatic rules.

pub async fn upholds(&self) -> Result<Vec<String>>

The units that this unit keeps running. The list comes from the unit file and from automatic rules.

Added in systemd 251.

pub async fn required_by(&self) -> Result<Vec<String>>

The units that require this unit.

pub async fn requisite_of(&self) -> Result<Vec<String>>

The units for which this unit is a requisite. The list comes from the unit file and from automatic rules.

pub async fn wanted_by(&self) -> Result<Vec<String>>

The units that have this unit in their Wants= list. The list comes from the unit file and from automatic rules.

pub async fn bound_by(&self) -> Result<Vec<String>>

The units that bind to this unit.

pub async fn upheld_by(&self) -> Result<Vec<String>>

The units that keep this unit running. The list comes from the unit file and from automatic rules.

Added in systemd 251.

pub async fn consists_of(&self) -> Result<Vec<String>>

The units that are part of this unit. The list comes from the unit file and from automatic rules.

pub async fn conflicts(&self) -> Result<Vec<String>>

The units that conflict with this unit. The list comes from the unit file and from automatic rules.

pub async fn conflicted_by(&self) -> Result<Vec<String>>

The units that name this unit as a conflict. The list comes from the unit file and from automatic rules.

pub async fn before(&self) -> Result<Vec<String>>

The units that start after this unit. The list comes from the unit file and from automatic rules.

pub async fn after(&self) -> Result<Vec<String>>

The units that start before this unit. The list comes from the unit file and from automatic rules.

pub async fn on_success(&self) -> Result<Vec<String>>

The units that start when this unit succeeds. The list comes from the unit file and from automatic rules.

pub async fn on_success_of(&self) -> Result<Vec<String>>

The units that start this unit when they succeed. The list comes from the unit file and from automatic rules.

pub async fn on_failure(&self) -> Result<Vec<String>>

The units that start when this unit fails. The list comes from the unit file and from automatic rules.

pub async fn on_failure_of(&self) -> Result<Vec<String>>

The units that start this unit when they fail. The list comes from the unit file and from automatic rules.

pub async fn triggers(&self) -> Result<Vec<String>>

The units that this unit triggers.

pub async fn triggered_by(&self) -> Result<Vec<String>>

The units that trigger this unit.

pub async fn propagates_reload_to(&self) -> Result<Vec<String>>

The units that get a reload when this unit reloads. The list comes from the unit file and from automatic rules.

pub async fn reload_propagated_from(&self) -> Result<Vec<String>>

The units that send their reloads to this unit. The list comes from the unit file and from automatic rules.

pub async fn propagates_stop_to(&self) -> Result<Vec<String>>

The units that stop when this unit stops. The list comes from the unit file and from automatic rules.

pub async fn stop_propagated_from(&self) -> Result<Vec<String>>

The units whose stop makes this unit stop. The list comes from the unit file and from automatic rules.

pub async fn joins_namespace_of(&self) -> Result<Vec<String>>

The units whose namespaces this unit joins. The list comes from the unit file and from automatic rules.

pub async fn slice_of(&self) -> Result<Vec<String>>

The units that run in this slice.

pub async fn requires_mounts_for(&self) -> Result<Vec<String>>

The paths that need their mount points before the unit starts.

pub async fn wants_mounts_for(&self) -> Result<Vec<String>>

The paths that WantsMountsFor= lists. The list comes from the unit file and from automatic rules.

Added in systemd 256.

pub async fn documentation(&self) -> Result<Vec<String>>

The URLs of the documentation of the unit.

pub async fn description(&self) -> Result<String>

The description of the unit for people.

pub async fn access_se_linux_context(&self) -> Result<String>

The SELinux context that controls access to the unit. The manager reads it when it loads the unit. It is empty if SELinux is off or no label exists.

Added in systemd 252.

pub async fn load_state(&self) -> Result<LoadState>

Whether the configuration of the unit is loaded.

pub async fn active_state(&self) -> Result<ActiveState>

The high-level state of the unit.

pub fn cached_active_state( &self, ) -> Result<Option<<Result<ActiveState> as ResultAdapter>::Ok>, <Result<ActiveState> as ResultAdapter>::Err>

The high-level state of the unit. Get the cached value of the ActiveState property, or None if the property is not cached.

pub async fn receive_active_state_changed( &self, ) -> PropertyStream<'p, <Result<ActiveState> as ResultAdapter>::Ok>

The high-level state of the unit. Create a stream for the ActiveState property changes. This is a convenient wrapper around [zbus::Proxy::receive_property_changed].

pub async fn freezer_state(&self) -> Result<FreezerState>

The freezer state of the unit.

pub fn cached_freezer_state( &self, ) -> Result<Option<<Result<FreezerState> as ResultAdapter>::Ok>, <Result<FreezerState> as ResultAdapter>::Err>

The freezer state of the unit. Get the cached value of the FreezerState property, or None if the property is not cached.

pub async fn receive_freezer_state_changed( &self, ) -> PropertyStream<'p, <Result<FreezerState> as ResultAdapter>::Ok>

The freezer state of the unit. Create a stream for the FreezerState property changes. This is a convenient wrapper around [zbus::Proxy::receive_property_changed].

pub async fn sub_state(&self) -> Result<String>

The finer state of the unit. The values depend on the unit type, and upstream does not list them.

pub fn cached_sub_state( &self, ) -> Result<Option<<Result<String> as ResultAdapter>::Ok>, <Result<String> as ResultAdapter>::Err>

The finer state of the unit. The values depend on the unit type, and upstream does not list them. Get the cached value of the SubState property, or None if the property is not cached.

pub async fn receive_sub_state_changed( &self, ) -> PropertyStream<'p, <Result<String> as ResultAdapter>::Ok>

The finer state of the unit. The values depend on the unit type, and upstream does not list them. Create a stream for the SubState property changes. This is a convenient wrapper around [zbus::Proxy::receive_property_changed].

pub async fn fragment_path(&self) -> Result<String>

The path of the unit file, or an empty string.

pub async fn source_path(&self) -> Result<String>

The path of the file that the manager generated the unit from, or an empty string for a native unit. A mount unit from /etc/fstab has /etc/fstab here.

pub async fn drop_in_paths(&self) -> Result<Vec<String>>

The paths of the drop-in files of the unit.

pub async fn unit_file_state(&self) -> Result<UnitFileState>

The install state of the unit file.

pub async fn unit_file_preset(&self) -> Result<UnitFilePreset>

The preset state of the unit file.

pub async fn state_change_timestamp(&self) -> Result<u64>

The time of the last state change, in microseconds since the UNIX epoch. It is 0 if it did not happen on this boot.

pub fn cached_state_change_timestamp( &self, ) -> Result<Option<<Result<u64> as ResultAdapter>::Ok>, <Result<u64> as ResultAdapter>::Err>

The time of the last state change, in microseconds since the UNIX epoch. It is 0 if it did not happen on this boot. Get the cached value of the StateChangeTimestamp property, or None if the property is not cached.

pub async fn receive_state_change_timestamp_changed( &self, ) -> PropertyStream<'p, <Result<u64> as ResultAdapter>::Ok>

The time of the last state change, in microseconds since the UNIX epoch. It is 0 if it did not happen on this boot. Create a stream for the StateChangeTimestamp property changes. This is a convenient wrapper around [zbus::Proxy::receive_property_changed].

pub async fn state_change_timestamp_monotonic(&self) -> Result<u64>

The time of the last state change on the monotonic clock, in microseconds. It is 0 if it did not happen on this boot.

pub fn cached_state_change_timestamp_monotonic( &self, ) -> Result<Option<<Result<u64> as ResultAdapter>::Ok>, <Result<u64> as ResultAdapter>::Err>

The time of the last state change on the monotonic clock, in microseconds. It is 0 if it did not happen on this boot. Get the cached value of the StateChangeTimestampMonotonic property, or None if the property is not cached.

pub async fn receive_state_change_timestamp_monotonic_changed( &self, ) -> PropertyStream<'p, <Result<u64> as ResultAdapter>::Ok>

The time of the last state change on the monotonic clock, in microseconds. It is 0 if it did not happen on this boot. Create a stream for the StateChangeTimestampMonotonic property changes. This is a convenient wrapper around [zbus::Proxy::receive_property_changed].

pub async fn inactive_exit_timestamp(&self) -> Result<u64>

The time when the unit last left the inactive state, in microseconds since the UNIX epoch. It is 0 if it did not happen on this boot.

pub fn cached_inactive_exit_timestamp( &self, ) -> Result<Option<<Result<u64> as ResultAdapter>::Ok>, <Result<u64> as ResultAdapter>::Err>

The time when the unit last left the inactive state, in microseconds since the UNIX epoch. It is 0 if it did not happen on this boot. Get the cached value of the InactiveExitTimestamp property, or None if the property is not cached.

pub async fn receive_inactive_exit_timestamp_changed( &self, ) -> PropertyStream<'p, <Result<u64> as ResultAdapter>::Ok>

The time when the unit last left the inactive state, in microseconds since the UNIX epoch. It is 0 if it did not happen on this boot. Create a stream for the InactiveExitTimestamp property changes. This is a convenient wrapper around [zbus::Proxy::receive_property_changed].

pub async fn inactive_exit_timestamp_monotonic(&self) -> Result<u64>

The time when the unit last left the inactive state on the monotonic clock, in microseconds. It is 0 if it did not happen on this boot.

pub fn cached_inactive_exit_timestamp_monotonic( &self, ) -> Result<Option<<Result<u64> as ResultAdapter>::Ok>, <Result<u64> as ResultAdapter>::Err>

The time when the unit last left the inactive state on the monotonic clock, in microseconds. It is 0 if it did not happen on this boot. Get the cached value of the InactiveExitTimestampMonotonic property, or None if the property is not cached.

pub async fn receive_inactive_exit_timestamp_monotonic_changed( &self, ) -> PropertyStream<'p, <Result<u64> as ResultAdapter>::Ok>

The time when the unit last left the inactive state on the monotonic clock, in microseconds. It is 0 if it did not happen on this boot. Create a stream for the InactiveExitTimestampMonotonic property changes. This is a convenient wrapper around [zbus::Proxy::receive_property_changed].

pub async fn active_enter_timestamp(&self) -> Result<u64>

The time when the unit last became active, in microseconds since the UNIX epoch. It is 0 if it did not happen on this boot.

pub fn cached_active_enter_timestamp( &self, ) -> Result<Option<<Result<u64> as ResultAdapter>::Ok>, <Result<u64> as ResultAdapter>::Err>

The time when the unit last became active, in microseconds since the UNIX epoch. It is 0 if it did not happen on this boot. Get the cached value of the ActiveEnterTimestamp property, or None if the property is not cached.

pub async fn receive_active_enter_timestamp_changed( &self, ) -> PropertyStream<'p, <Result<u64> as ResultAdapter>::Ok>

The time when the unit last became active, in microseconds since the UNIX epoch. It is 0 if it did not happen on this boot. Create a stream for the ActiveEnterTimestamp property changes. This is a convenient wrapper around [zbus::Proxy::receive_property_changed].

pub async fn active_enter_timestamp_monotonic(&self) -> Result<u64>

The time when the unit last became active on the monotonic clock, in microseconds. It is 0 if it did not happen on this boot.

pub fn cached_active_enter_timestamp_monotonic( &self, ) -> Result<Option<<Result<u64> as ResultAdapter>::Ok>, <Result<u64> as ResultAdapter>::Err>

The time when the unit last became active on the monotonic clock, in microseconds. It is 0 if it did not happen on this boot. Get the cached value of the ActiveEnterTimestampMonotonic property, or None if the property is not cached.

pub async fn receive_active_enter_timestamp_monotonic_changed( &self, ) -> PropertyStream<'p, <Result<u64> as ResultAdapter>::Ok>

The time when the unit last became active on the monotonic clock, in microseconds. It is 0 if it did not happen on this boot. Create a stream for the ActiveEnterTimestampMonotonic property changes. This is a convenient wrapper around [zbus::Proxy::receive_property_changed].

pub async fn active_exit_timestamp(&self) -> Result<u64>

The time when the unit last left the active state, in microseconds since the UNIX epoch. It is 0 if it did not happen on this boot.

pub fn cached_active_exit_timestamp( &self, ) -> Result<Option<<Result<u64> as ResultAdapter>::Ok>, <Result<u64> as ResultAdapter>::Err>

The time when the unit last left the active state, in microseconds since the UNIX epoch. It is 0 if it did not happen on this boot. Get the cached value of the ActiveExitTimestamp property, or None if the property is not cached.

pub async fn receive_active_exit_timestamp_changed( &self, ) -> PropertyStream<'p, <Result<u64> as ResultAdapter>::Ok>

The time when the unit last left the active state, in microseconds since the UNIX epoch. It is 0 if it did not happen on this boot. Create a stream for the ActiveExitTimestamp property changes. This is a convenient wrapper around [zbus::Proxy::receive_property_changed].

pub async fn active_exit_timestamp_monotonic(&self) -> Result<u64>

The time when the unit last left the active state on the monotonic clock, in microseconds. It is 0 if it did not happen on this boot.

pub fn cached_active_exit_timestamp_monotonic( &self, ) -> Result<Option<<Result<u64> as ResultAdapter>::Ok>, <Result<u64> as ResultAdapter>::Err>

The time when the unit last left the active state on the monotonic clock, in microseconds. It is 0 if it did not happen on this boot. Get the cached value of the ActiveExitTimestampMonotonic property, or None if the property is not cached.

pub async fn receive_active_exit_timestamp_monotonic_changed( &self, ) -> PropertyStream<'p, <Result<u64> as ResultAdapter>::Ok>

The time when the unit last left the active state on the monotonic clock, in microseconds. It is 0 if it did not happen on this boot. Create a stream for the ActiveExitTimestampMonotonic property changes. This is a convenient wrapper around [zbus::Proxy::receive_property_changed].

pub async fn inactive_enter_timestamp(&self) -> Result<u64>

The time when the unit last became inactive, in microseconds since the UNIX epoch. It is 0 if it did not happen on this boot.

pub fn cached_inactive_enter_timestamp( &self, ) -> Result<Option<<Result<u64> as ResultAdapter>::Ok>, <Result<u64> as ResultAdapter>::Err>

The time when the unit last became inactive, in microseconds since the UNIX epoch. It is 0 if it did not happen on this boot. Get the cached value of the InactiveEnterTimestamp property, or None if the property is not cached.

pub async fn receive_inactive_enter_timestamp_changed( &self, ) -> PropertyStream<'p, <Result<u64> as ResultAdapter>::Ok>

The time when the unit last became inactive, in microseconds since the UNIX epoch. It is 0 if it did not happen on this boot. Create a stream for the InactiveEnterTimestamp property changes. This is a convenient wrapper around [zbus::Proxy::receive_property_changed].

pub async fn inactive_enter_timestamp_monotonic(&self) -> Result<u64>

The time when the unit last became inactive on the monotonic clock, in microseconds. It is 0 if it did not happen on this boot.

pub fn cached_inactive_enter_timestamp_monotonic( &self, ) -> Result<Option<<Result<u64> as ResultAdapter>::Ok>, <Result<u64> as ResultAdapter>::Err>

The time when the unit last became inactive on the monotonic clock, in microseconds. It is 0 if it did not happen on this boot. Get the cached value of the InactiveEnterTimestampMonotonic property, or None if the property is not cached.

pub async fn receive_inactive_enter_timestamp_monotonic_changed( &self, ) -> PropertyStream<'p, <Result<u64> as ResultAdapter>::Ok>

The time when the unit last became inactive on the monotonic clock, in microseconds. It is 0 if it did not happen on this boot. Create a stream for the InactiveEnterTimestampMonotonic property changes. This is a convenient wrapper around [zbus::Proxy::receive_property_changed].

pub async fn can_start(&self) -> Result<bool>

Whether the unit supports start. The caller may still lack the privileges.

pub async fn can_stop(&self) -> Result<bool>

Whether the unit supports stop. The caller may still lack the privileges.

pub async fn can_reload(&self) -> Result<bool>

Whether the unit supports reload. The caller may still lack the privileges.

pub async fn can_isolate(&self) -> Result<bool>

Whether the unit can start in the isolate mode.

pub async fn can_clean(&self) -> Result<Vec<CleanResource>>

The kinds of data that UnitProxy::clean can delete. The strings are the values of CleanResource.

pub async fn can_freeze(&self) -> Result<bool>

Whether the unit supports freezing.

pub async fn can_live_mount(&self) -> Result<bool>

Whether the unit supports live mounts.

Added in systemd 257.

pub async fn job(&self) -> Result<UnitJobRef>

The job that is queued or running for the unit. The job ID is 0 if there is none.

pub fn cached_job( &self, ) -> Result<Option<<Result<UnitJobRef> as ResultAdapter>::Ok>, <Result<UnitJobRef> as ResultAdapter>::Err>

The job that is queued or running for the unit. The job ID is 0 if there is none. Get the cached value of the Job property, or None if the property is not cached.

pub async fn receive_job_changed( &self, ) -> PropertyStream<'p, <Result<UnitJobRef> as ResultAdapter>::Ok>

The job that is queued or running for the unit. The job ID is 0 if there is none. Create a stream for the Job property changes. This is a convenient wrapper around [zbus::Proxy::receive_property_changed].

pub async fn stop_when_unneeded(&self) -> Result<bool>

The StopWhenUnneeded= setting.

pub async fn refuse_manual_start(&self) -> Result<bool>

The RefuseManualStart= setting.

pub async fn refuse_manual_stop(&self) -> Result<bool>

The RefuseManualStop= setting.

pub async fn allow_isolate(&self) -> Result<bool>

The AllowIsolate= setting.

pub async fn default_dependencies(&self) -> Result<bool>

The DefaultDependencies= setting.

pub async fn survive_final_kill_signal(&self) -> Result<bool>

The SurviveFinalKillSignal= setting.

Added in systemd 255.

pub async fn on_success_job_mode(&self) -> Result<JobMode>

The OnSuccessJobMode= setting.

Added in systemd 250.

pub async fn on_failure_job_mode(&self) -> Result<JobMode>

The OnFailureJobMode= setting.

pub async fn ignore_on_isolate(&self) -> Result<bool>

The IgnoreOnIsolate= setting.

pub async fn need_daemon_reload(&self) -> Result<bool>

Whether the configuration file of the unit changed since the manager read it. A reload is advisable then.

pub async fn markers(&self) -> Result<Vec<UnitMarker>>

The pending actions on the unit, recorded as markers. The strings are the values of UnitMarker. Tools set them through SetProperties. The manager clears them when the action happens.

pub async fn job_timeout_usec(&self) -> Result<u64>

The JobTimeoutSec= setting, in microseconds.

pub async fn job_running_timeout_usec(&self) -> Result<u64>

The JobRunningTimeoutSec= setting, in microseconds.

pub async fn job_timeout_action(&self) -> Result<EmergencyAction>

The JobTimeoutAction= setting.

pub async fn job_timeout_reboot_argument(&self) -> Result<String>

The JobTimeoutRebootArgument= setting.

pub async fn condition_result(&self) -> Result<bool>

The result of the last check of the conditions.

pub fn cached_condition_result( &self, ) -> Result<Option<<Result<bool> as ResultAdapter>::Ok>, <Result<bool> as ResultAdapter>::Err>

The result of the last check of the conditions. Get the cached value of the ConditionResult property, or None if the property is not cached.

pub async fn receive_condition_result_changed( &self, ) -> PropertyStream<'p, <Result<bool> as ResultAdapter>::Ok>

The result of the last check of the conditions. Create a stream for the ConditionResult property changes. This is a convenient wrapper around [zbus::Proxy::receive_property_changed].

pub async fn assert_result(&self) -> Result<bool>

The result of the last check of the assertions.

pub fn cached_assert_result( &self, ) -> Result<Option<<Result<bool> as ResultAdapter>::Ok>, <Result<bool> as ResultAdapter>::Err>

The result of the last check of the assertions. Get the cached value of the AssertResult property, or None if the property is not cached.

pub async fn receive_assert_result_changed( &self, ) -> PropertyStream<'p, <Result<bool> as ResultAdapter>::Ok>

The result of the last check of the assertions. Create a stream for the AssertResult property changes. This is a convenient wrapper around [zbus::Proxy::receive_property_changed].

pub async fn condition_timestamp(&self) -> Result<u64>

The time of the last check of the conditions, in microseconds since the UNIX epoch. It is 0 if they were never checked.

pub fn cached_condition_timestamp( &self, ) -> Result<Option<<Result<u64> as ResultAdapter>::Ok>, <Result<u64> as ResultAdapter>::Err>

The time of the last check of the conditions, in microseconds since the UNIX epoch. It is 0 if they were never checked. Get the cached value of the ConditionTimestamp property, or None if the property is not cached.

pub async fn receive_condition_timestamp_changed( &self, ) -> PropertyStream<'p, <Result<u64> as ResultAdapter>::Ok>

The time of the last check of the conditions, in microseconds since the UNIX epoch. It is 0 if they were never checked. Create a stream for the ConditionTimestamp property changes. This is a convenient wrapper around [zbus::Proxy::receive_property_changed].

pub async fn condition_timestamp_monotonic(&self) -> Result<u64>

The time of the last check of the conditions on the monotonic clock, in microseconds. It is 0 if they were never checked.

pub fn cached_condition_timestamp_monotonic( &self, ) -> Result<Option<<Result<u64> as ResultAdapter>::Ok>, <Result<u64> as ResultAdapter>::Err>

The time of the last check of the conditions on the monotonic clock, in microseconds. It is 0 if they were never checked. Get the cached value of the ConditionTimestampMonotonic property, or None if the property is not cached.

pub async fn receive_condition_timestamp_monotonic_changed( &self, ) -> PropertyStream<'p, <Result<u64> as ResultAdapter>::Ok>

The time of the last check of the conditions on the monotonic clock, in microseconds. It is 0 if they were never checked. Create a stream for the ConditionTimestampMonotonic property changes. This is a convenient wrapper around [zbus::Proxy::receive_property_changed].

pub async fn assert_timestamp(&self) -> Result<u64>

The time of the last check of the assertions, in microseconds since the UNIX epoch. It is 0 if they were never checked.

pub fn cached_assert_timestamp( &self, ) -> Result<Option<<Result<u64> as ResultAdapter>::Ok>, <Result<u64> as ResultAdapter>::Err>

The time of the last check of the assertions, in microseconds since the UNIX epoch. It is 0 if they were never checked. Get the cached value of the AssertTimestamp property, or None if the property is not cached.

pub async fn receive_assert_timestamp_changed( &self, ) -> PropertyStream<'p, <Result<u64> as ResultAdapter>::Ok>

The time of the last check of the assertions, in microseconds since the UNIX epoch. It is 0 if they were never checked. Create a stream for the AssertTimestamp property changes. This is a convenient wrapper around [zbus::Proxy::receive_property_changed].

pub async fn assert_timestamp_monotonic(&self) -> Result<u64>

The time of the last check of the assertions on the monotonic clock, in microseconds. It is 0 if they were never checked.

pub fn cached_assert_timestamp_monotonic( &self, ) -> Result<Option<<Result<u64> as ResultAdapter>::Ok>, <Result<u64> as ResultAdapter>::Err>

The time of the last check of the assertions on the monotonic clock, in microseconds. It is 0 if they were never checked. Get the cached value of the AssertTimestampMonotonic property, or None if the property is not cached.

pub async fn receive_assert_timestamp_monotonic_changed( &self, ) -> PropertyStream<'p, <Result<u64> as ResultAdapter>::Ok>

The time of the last check of the assertions on the monotonic clock, in microseconds. It is 0 if they were never checked. Create a stream for the AssertTimestampMonotonic property changes. This is a convenient wrapper around [zbus::Proxy::receive_property_changed].

pub async fn conditions(&self) -> Result<Vec<UnitCondition>>

The conditions of the unit. A change invalidates the value, so read the property again.

pub fn cached_conditions( &self, ) -> Result<Option<<Result<Vec<UnitCondition>> as ResultAdapter>::Ok>, <Result<Vec<UnitCondition>> as ResultAdapter>::Err>

The conditions of the unit. A change invalidates the value, so read the property again. Get the cached value of the Conditions property, or None if the property is not cached.

pub async fn receive_conditions_changed( &self, ) -> PropertyStream<'p, <Result<Vec<UnitCondition>> as ResultAdapter>::Ok>

The conditions of the unit. A change invalidates the value, so read the property again. Create a stream for the Conditions property changes. This is a convenient wrapper around [zbus::Proxy::receive_property_changed].

pub async fn asserts(&self) -> Result<Vec<UnitCondition>>

The assertions of the unit. A change invalidates the value, so read the property again.

pub fn cached_asserts( &self, ) -> Result<Option<<Result<Vec<UnitCondition>> as ResultAdapter>::Ok>, <Result<Vec<UnitCondition>> as ResultAdapter>::Err>

The assertions of the unit. A change invalidates the value, so read the property again. Get the cached value of the Asserts property, or None if the property is not cached.

pub async fn receive_asserts_changed( &self, ) -> PropertyStream<'p, <Result<Vec<UnitCondition>> as ResultAdapter>::Ok>

The assertions of the unit. A change invalidates the value, so read the property again. Create a stream for the Asserts property changes. This is a convenient wrapper around [zbus::Proxy::receive_property_changed].

pub async fn load_error(&self) -> Result<LoadError>

The reason why the unit failed to load. Both fields are empty if it loaded.

pub async fn transient(&self) -> Result<bool>

Whether the unit is a transient unit, which means StartTransientUnit created it.

pub fn cached_transient( &self, ) -> Result<Option<<Result<bool> as ResultAdapter>::Ok>, <Result<bool> as ResultAdapter>::Err>

Whether the unit is a transient unit, which means StartTransientUnit created it. Get the cached value of the Transient property, or None if the property is not cached.

pub async fn perpetual(&self) -> Result<bool>

Whether the unit is perpetual. The manager creates such units itself and never unloads them.

pub fn cached_perpetual( &self, ) -> Result<Option<<Result<bool> as ResultAdapter>::Ok>, <Result<bool> as ResultAdapter>::Err>

Whether the unit is perpetual. The manager creates such units itself and never unloads them. Get the cached value of the Perpetual property, or None if the property is not cached.

pub async fn start_limit_interval_usec(&self) -> Result<u64>

The StartLimitIntervalSec= setting, in microseconds.

pub async fn start_limit_burst(&self) -> Result<u32>

The StartLimitBurst= setting.

pub async fn start_limit_action(&self) -> Result<EmergencyAction>

The StartLimitAction= setting.

pub async fn failure_action(&self) -> Result<EmergencyAction>

The FailureAction= setting.

pub async fn failure_action_exit_status(&self) -> Result<i32>

The FailureActionExitStatus= setting.

pub async fn success_action(&self) -> Result<EmergencyAction>

The SuccessAction= setting.

pub async fn success_action_exit_status(&self) -> Result<i32>

The SuccessActionExitStatus= setting.

pub async fn reboot_argument(&self) -> Result<String>

The RebootArgument= setting.

pub async fn invocation_id(&self) -> Result<Vec<u8>>

The invocation ID of the unit as 16 bytes, or an empty array.

pub fn cached_invocation_id( &self, ) -> Result<Option<<Result<Vec<u8>> as ResultAdapter>::Ok>, <Result<Vec<u8>> as ResultAdapter>::Err>

The invocation ID of the unit as 16 bytes, or an empty array. Get the cached value of the InvocationID property, or None if the property is not cached.

pub async fn receive_invocation_id_changed( &self, ) -> PropertyStream<'p, <Result<Vec<u8>> as ResultAdapter>::Ok>

The invocation ID of the unit as 16 bytes, or an empty array. Create a stream for the InvocationID property changes. This is a convenient wrapper around [zbus::Proxy::receive_property_changed].

pub async fn collect_mode(&self) -> Result<CollectMode>

The CollectMode= setting.

pub async fn refs(&self) -> Result<Vec<String>>

The clients that hold a reference to the unit.

pub async fn activation_details(&self) -> Result<Vec<(String, String)>>

Key and value pairs that describe the event that activated the unit. They are set only for units that a path or timer unit triggered, and only on a best effort basis. The keys match the lowercase names of the environment variables that systemd.exec lists for the manager. New keys can appear.

Added in systemd 252.

pub fn cached_activation_details( &self, ) -> Result<Option<<Result<Vec<(String, String)>> as ResultAdapter>::Ok>, <Result<Vec<(String, String)>> as ResultAdapter>::Err>

Key and value pairs that describe the event that activated the unit. They are set only for units that a path or timer unit triggered, and only on a best effort basis. The keys match the lowercase names of the environment variables that systemd.exec lists for the manager. New keys can appear.

Added in systemd 252. Get the cached value of the ActivationDetails property, or None if the property is not cached.

pub async fn receive_activation_details_changed( &self, ) -> PropertyStream<'p, <Result<Vec<(String, String)>> as ResultAdapter>::Ok>

Key and value pairs that describe the event that activated the unit. They are set only for units that a path or timer unit triggered, and only on a best effort basis. The keys match the lowercase names of the environment variables that systemd.exec lists for the manager. New keys can appear.

Added in systemd 252. Create a stream for the ActivationDetails property changes. This is a convenient wrapper around [zbus::Proxy::receive_property_changed].

pub async fn debug_invocation(&self) -> Result<bool>

Whether the unit runs with the debug log level after an earlier failure. It follows the RestartMode= setting of the service.

Added in systemd 257.

Trait Implementations§

§

impl<'p> AsMut<Proxy<'p>> for UnitProxy<'p>

§

fn as_mut(&mut self) -> &mut Proxy<'p>

Converts this type into a mutable reference of the (usually inferred) input type.
§

impl<'p> AsRef<Proxy<'p>> for UnitProxy<'p>

§

fn as_ref(&self) -> &Proxy<'p>

Converts this type into a shared reference of the (usually inferred) input type.
§

impl<'p> Clone for UnitProxy<'p>

§

fn clone(&self) -> UnitProxy<'p>

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
§

impl<'p> Debug for UnitProxy<'p>

§

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

Formats the value using the given formatter. Read more
§

impl<'a> Defaults for UnitProxy<'a>

§

const INTERFACE: &'static Option<InterfaceName<'static>>

§

const DESTINATION: &'static Option<BusName<'static>>

§

const PATH: &'static Option<ObjectPath<'static>>

§

impl<'p> From<Proxy<'p>> for UnitProxy<'p>

§

fn from(proxy: Proxy<'p>) -> Self

Converts to this type from the input type.
§

impl<'p> ProxyImpl<'p> for UnitProxy<'p>

§

fn builder(conn: &Connection) -> Builder<'p, Self>

Return a customizable builder for this proxy.
§

fn into_inner(self) -> Proxy<'p>

Consume self, returning the underlying zbus::Proxy.
§

fn inner(&self) -> &Proxy<'p>

The reference to the underlying zbus::Proxy.
§

impl<'p> Serialize for UnitProxy<'p>

§

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more
§

impl<'p> Type for UnitProxy<'p>

§

const SIGNATURE: &'static Signature

The signature for the implementing type, in parsed format. Read more

Auto Trait Implementations§

§

impl<'p> !RefUnwindSafe for UnitProxy<'p>

§

impl<'p> !UnwindSafe for UnitProxy<'p>

§

impl<'p> Freeze for UnitProxy<'p>

§

impl<'p> Send for UnitProxy<'p>

§

impl<'p> Sync for UnitProxy<'p>

§

impl<'p> Unpin for UnitProxy<'p>

§

impl<'p> UnsafeUnpin for UnitProxy<'p>

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
§

impl<T> DynamicType for T
where T: Type + ?Sized,

§

fn signature(&self) -> Signature

The type signature for self. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more