pub struct AppReplica;
Expand description
Exposes the ways for the application to introspect its own runtime replica, primarily via a numerical index (injected via the environment at runtime).
Implementations§
Source§impl AppReplica
impl AppReplica
Sourcepub fn index() -> Option<usize>
pub fn index() -> Option<usize>
Returns the usize
index of this application’s replica. Lazily discerns
the value on the first call, then returns a copy of the same value on
each repeated call.
This value can be set from the APP_REPLICA_INDEX
environment variable
at runtime. The same environment variable set at compile time
produces no effect.
If the environment variable is not set at runtime, or its value is not a
valid usize
integer, this method will return None
. Otherwise, no
validation is performed on the value.
Sourcepub fn lifetime_id() -> &'static LifetimeId
pub fn lifetime_id() -> &'static LifetimeId
Returns a pseudo-randomized LifetimeId
of this application’s replica
that is stable throughout a single runtime. Lazily generates the value
on the first call.
This pseudo-randomized value is not cryptographically secure.