pub struct QueryContentResponse {
pub content_cid: ContentCid,
pub providers: Vec<ContentProvider>,
pub total_providers: usize,
}Expand description
Response to content query.
§Examples
use chie_shared::{QueryContentResponse, ContentProvider};
// Response with multiple providers
let response = QueryContentResponse {
content_cid: "QmExample".to_string(),
providers: vec![
ContentProvider {
peer_id: "12D3Koo1".to_string(),
addresses: vec!["/ip4/1.2.3.4/tcp/4001".to_string()],
available_chunks: Some(vec![0, 1, 2, 3]),
reputation: Some(98.5),
last_seen: None,
},
ContentProvider {
peer_id: "12D3Koo2".to_string(),
addresses: vec!["/ip4/5.6.7.8/tcp/4001".to_string()],
available_chunks: None,
reputation: Some(87.0),
last_seen: None,
},
],
total_providers: 5,
};
assert_eq!(response.providers.len(), 2);
assert_eq!(response.total_providers, 5);Fields§
§content_cid: ContentCidContent CID that was queried.
providers: Vec<ContentProvider>List of providers.
total_providers: usizeTotal number of providers available.
Trait Implementations§
Source§impl Clone for QueryContentResponse
impl Clone for QueryContentResponse
Source§fn clone(&self) -> QueryContentResponse
fn clone(&self) -> QueryContentResponse
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for QueryContentResponse
impl Debug for QueryContentResponse
Source§impl<'de> Deserialize<'de> for QueryContentResponse
impl<'de> Deserialize<'de> for QueryContentResponse
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for QueryContentResponse
impl RefUnwindSafe for QueryContentResponse
impl Send for QueryContentResponse
impl Sync for QueryContentResponse
impl Unpin for QueryContentResponse
impl UnwindSafe for QueryContentResponse
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