Struct etcd_client::LeaderKey
source · pub struct LeaderKey(/* private fields */);
Expand description
Leader key of election
Implementations§
source§impl LeaderKey
impl LeaderKey
sourcepub fn with_name(self, name: impl Into<Vec<u8>>) -> Self
pub fn with_name(self, name: impl Into<Vec<u8>>) -> Self
The election identifier that corresponds to the leadership key.
sourcepub fn with_key(self, key: impl Into<Vec<u8>>) -> Self
pub fn with_key(self, key: impl Into<Vec<u8>>) -> Self
An opaque key representing the ownership of the election.
sourcepub const fn with_lease(self, lease: i64) -> Self
pub const fn with_lease(self, lease: i64) -> Self
The lease ID of the election leader.
sourcepub fn name(&self) -> &[u8] ⓘ
pub fn name(&self) -> &[u8] ⓘ
The name in byte. name is the election identifier that corresponds to the leadership key.
sourcepub fn name_str(&self) -> Result<&str, Error>
pub fn name_str(&self) -> Result<&str, Error>
The name in string. name is the election identifier that corresponds to the leadership key.
sourcepub unsafe fn name_str_unchecked(&self) -> &str
pub unsafe fn name_str_unchecked(&self) -> &str
The name in string. name is the election identifier that corresponds to the leadership key.
§Safety
This function is unsafe because it does not check that the bytes of the key are valid UTF-8.
If this constraint is violated, undefined behavior results,
as the rest of Rust assumes that &str
s are valid UTF-8.
sourcepub fn key(&self) -> &[u8] ⓘ
pub fn key(&self) -> &[u8] ⓘ
The key in byte. key is an opaque key representing the ownership of the election. If the key is deleted, then leadership is lost.
sourcepub fn key_str(&self) -> Result<&str, Error>
pub fn key_str(&self) -> Result<&str, Error>
The key in string. key is an opaque key representing the ownership of the election. If the key is deleted, then leadership is lost.
sourcepub unsafe fn key_str_unchecked(&self) -> &str
pub unsafe fn key_str_unchecked(&self) -> &str
The key in string. key is an opaque key representing the ownership of the election. If the key is deleted, then leadership is lost.
§Safety
This function is unsafe because it does not check that the bytes of the key are valid UTF-8.
If this constraint is violated, undefined behavior results,
as the rest of Rust assumes that &str
s are valid UTF-8.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for LeaderKey
impl RefUnwindSafe for LeaderKey
impl Send for LeaderKey
impl Sync for LeaderKey
impl Unpin for LeaderKey
impl UnwindSafe for LeaderKey
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T
in a tonic::Request