pub struct LeaseHelper { /* private fields */ }Expand description
Helper for acquiring leases. Instantiate with LeaseControl::new(), and then acquire a lease with the lease() method. The lease() call will return only once the lease is satisfied.
A single LeaseHelper may be reused to create leases an arbitrary number of times.
Implementations§
Source§impl LeaseHelper
impl LeaseHelper
Sourcepub async fn new<'a>(
topology: &'a TopologyProxy,
name: &'a str,
lease_dependencies: Vec<LeaseDependency>,
) -> Result<Arc<Self>>
pub async fn new<'a>( topology: &'a TopologyProxy, name: &'a str, lease_dependencies: Vec<LeaseDependency>, ) -> Result<Arc<Self>>
Creates a new LeaseHelper. Returns an error upon failure to register the to-be-leased power element with Power Broker.
Sourcepub async fn create_lease_and_wait_until_satisfied(
self: &Arc<Self>,
) -> Result<Lease>
pub async fn create_lease_and_wait_until_satisfied( self: &Arc<Self>, ) -> Result<Lease>
Acquires a lease, completing only once the lease is satisfied. Returns an error if the
underlying Lessor.Lease or LeaseControl.WatchStatus call fails.
pub async fn create_lease(self: &Arc<Self>) -> Result<Lease>
Auto Trait Implementations§
impl Freeze for LeaseHelper
impl !RefUnwindSafe for LeaseHelper
impl Send for LeaseHelper
impl Sync for LeaseHelper
impl Unpin for LeaseHelper
impl UnsafeUnpin for LeaseHelper
impl !UnwindSafe for LeaseHelper
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
impl<T, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
Source§impl<T, D> Encode<Ambiguous2, D> for Twhere
D: ResourceDialect,
impl<T, D> Encode<Ambiguous2, D> for Twhere
D: ResourceDialect,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more