pub struct Entry<'a> { /* private fields */ }
Expand description
DHT entry builder
Implementations§
Source§impl<'a> Entry<'a>
impl<'a> Entry<'a>
Sourcepub fn with_key_index(self, idx: u32) -> Self
pub fn with_key_index(self, idx: u32) -> Self
Sets the key index. Default: 0
Sourcepub fn with_data<T>(self, data: T) -> EntryWithData<'a>
pub fn with_data<T>(self, data: T) -> EntryWithData<'a>
Creates a new builder which can store the value in the DHT.
See with_data_raw
for raw API
Sourcepub fn with_data_raw(self, data: &'a [u8]) -> EntryWithData<'a>
pub fn with_data_raw(self, data: &'a [u8]) -> EntryWithData<'a>
Creates a new builder which can store the value in the DHT.
See with_data
for more convenient API
Sourcepub fn values<T>(self) -> DhtValuesStream<T>
pub fn values<T>(self) -> DhtValuesStream<T>
Returns a stream of values for this entry.
Sourcepub async fn value_from<T>(
self,
peer_id: &NodeIdShort,
) -> Result<Option<(KeyDescriptionOwned, T)>>
pub async fn value_from<T>( self, peer_id: &NodeIdShort, ) -> Result<Option<(KeyDescriptionOwned, T)>>
Queries a value from the given peer.
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for Entry<'a>
impl<'a> !RefUnwindSafe for Entry<'a>
impl<'a> Send for Entry<'a>
impl<'a> Sync for Entry<'a>
impl<'a> Unpin for Entry<'a>
impl<'a> !UnwindSafe for Entry<'a>
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