pub struct DownloadResult {
pub content: Vec<u8>,
pub source: DirPort,
pub runtime: Duration,
}Expand description
Result of a successful descriptor download.
Contains the downloaded content along with metadata about the download including the source endpoint and timing information.
§Example
use stem_rs::descriptor::remote::download_consensus;
use std::time::Duration;
let result = download_consensus(false, None, Some(Duration::from_secs(30))).await?;
println!("Downloaded {} bytes", result.content.len());
println!("From: {:?}", result.source.socket_addr());
println!("Time: {:?}", result.runtime);Fields§
§content: Vec<u8>The downloaded content as raw bytes.
This may be compressed depending on what the server sent. Use the appropriate decompression based on the Content-Encoding header (not currently exposed).
source: DirPortThe endpoint that provided this content.
Useful for debugging and logging which server was used.
runtime: DurationHow long the download took.
Includes connection time, request/response, and data transfer.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for DownloadResult
impl RefUnwindSafe for DownloadResult
impl Send for DownloadResult
impl Sync for DownloadResult
impl Unpin for DownloadResult
impl UnwindSafe for DownloadResult
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