You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We implement some request wrappers in the xline-client crate, like
/// Xline/crates/xline-client/src/types/lock.rs/// Request for `Lock`#[derive(Debug,PartialEq)]pubstructLockRequest{/// The inner requestpub(crate)inner: xlineapi::LockRequest,/// The ttl of the lease that attached to the lockpub(crate)ttl:i64,}implLockRequest{/// Creates a new `LockRequest`#[inline]#[must_use]pubfnnew(name:implInto<Vec<u8>>) -> Self{
...}/// Set lease.#[inline]#[must_use]pubconstfnwith_lease(mutself,lease:i64) -> Self{self.inner.lease = lease;self}/// Set session TTL./// Will be ignored when lease id is set#[inline]#[must_use]pubconstfnwith_ttl(mutself,ttl:i64) -> Self{self.ttl = ttl;self}}
Therefore, when we want to perform a lock operation by xline-client, we should write some code like this:
This way is not very user-friendly. I prefer to use lock_client.lock("lock-test", 50) rather than lock_client.lock(LockRequest::new("lock-test").with_ttl(50)).
The text was updated successfully, but these errors were encountered:
We implement some request wrappers in the xline-client crate, like
Therefore, when we want to perform a lock operation by xline-client, we should write some code like this:
This way is not very user-friendly. I prefer to use
lock_client.lock("lock-test", 50)
rather thanlock_client.lock(LockRequest::new("lock-test").with_ttl(50))
.The text was updated successfully, but these errors were encountered: