Enum lava_torrent::tracker::TrackerResponse
source · pub enum TrackerResponse {
Success {
interval: Integer,
peers: Vec<Peer>,
warning: Option<String>,
min_interval: Option<Integer>,
tracker_id: Option<String>,
complete: Option<Integer>,
incomplete: Option<Integer>,
extra_fields: Option<Dictionary>,
},
Failure {
reason: String,
},
}
Expand description
Everything found in a tracker response.
Modeled after the specifications in
BEP 3 and
theory.org.
Unknown/extension fields will be placed in extra_fields
. If you
need any of those extra fields you would have to parse it yourself.
Variants§
Success
Fields
§
min_interval: Option<Integer>
Minimum announce interval. If present clients must not reannounce more frequently than this.
§
extra_fields: Option<Dictionary>
Fields not listed above.
Failure
Implementations§
source§impl TrackerResponse
impl TrackerResponse
sourcepub fn from_bytes<B>(bytes: B) -> Result<TrackerResponse, LavaTorrentError>where
B: AsRef<[u8]>,
pub fn from_bytes<B>(bytes: B) -> Result<TrackerResponse, LavaTorrentError>where B: AsRef<[u8]>,
Parse bytes
and return the extracted TrackerResponse
.
If bytes
is missing any required field (e.g. interval
), or if any other
error is encountered (e.g. IOError
), then Err(error)
will be returned.
Trait Implementations§
source§impl Clone for TrackerResponse
impl Clone for TrackerResponse
source§fn clone(&self) -> TrackerResponse
fn clone(&self) -> TrackerResponse
Returns a copy 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 TrackerResponse
impl Debug for TrackerResponse
source§impl Display for TrackerResponse
impl Display for TrackerResponse
source§impl PartialEq<TrackerResponse> for TrackerResponse
impl PartialEq<TrackerResponse> for TrackerResponse
source§fn eq(&self, other: &TrackerResponse) -> bool
fn eq(&self, other: &TrackerResponse) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.impl Eq for TrackerResponse
impl StructuralEq for TrackerResponse
impl StructuralPartialEq for TrackerResponse
Auto Trait Implementations§
impl RefUnwindSafe for TrackerResponse
impl Send for TrackerResponse
impl Sync for TrackerResponse
impl Unpin for TrackerResponse
impl UnwindSafe for TrackerResponse
Blanket Implementations§
source§impl<Src, Scheme> ApproxFrom<Src, Scheme> for Srcwhere
Scheme: ApproxScheme,
impl<Src, Scheme> ApproxFrom<Src, Scheme> for Srcwhere Scheme: ApproxScheme,
source§fn approx_from(src: Src) -> Result<Src, <Src as ApproxFrom<Src, Scheme>>::Err>
fn approx_from(src: Src) -> Result<Src, <Src as ApproxFrom<Src, Scheme>>::Err>
Convert the given value into an approximately equivalent representation.
source§impl<Dst, Src, Scheme> ApproxInto<Dst, Scheme> for Srcwhere
Dst: ApproxFrom<Src, Scheme>,
Scheme: ApproxScheme,
impl<Dst, Src, Scheme> ApproxInto<Dst, Scheme> for Srcwhere Dst: ApproxFrom<Src, Scheme>, Scheme: ApproxScheme,
§type Err = <Dst as ApproxFrom<Src, Scheme>>::Err
type Err = <Dst as ApproxFrom<Src, Scheme>>::Err
The error type produced by a failed conversion.
source§fn approx_into(self) -> Result<Dst, <Src as ApproxInto<Dst, Scheme>>::Err>
fn approx_into(self) -> Result<Dst, <Src as ApproxInto<Dst, Scheme>>::Err>
Convert the subject into an approximately equivalent representation.
source§impl<T, Dst> ConvAsUtil<Dst> for T
impl<T, Dst> ConvAsUtil<Dst> for T
source§fn approx(self) -> Result<Dst, Self::Err>where
Self: Sized + ApproxInto<Dst, DefaultApprox>,
fn approx(self) -> Result<Dst, Self::Err>where Self: Sized + ApproxInto<Dst, DefaultApprox>,
Approximate the subject with the default scheme.
source§fn approx_by<Scheme>(self) -> Result<Dst, Self::Err>where
Self: Sized + ApproxInto<Dst, Scheme>,
Scheme: ApproxScheme,
fn approx_by<Scheme>(self) -> Result<Dst, Self::Err>where Self: Sized + ApproxInto<Dst, Scheme>, Scheme: ApproxScheme,
Approximate the subject with a specific scheme.
source§impl<T> ConvUtil for T
impl<T> ConvUtil for T
source§fn approx_as<Dst>(self) -> Result<Dst, Self::Err>where
Self: Sized + ApproxInto<Dst, DefaultApprox>,
fn approx_as<Dst>(self) -> Result<Dst, Self::Err>where Self: Sized + ApproxInto<Dst, DefaultApprox>,
Approximate the subject to a given type with the default scheme.
source§fn approx_as_by<Dst, Scheme>(self) -> Result<Dst, Self::Err>where
Self: Sized + ApproxInto<Dst, Scheme>,
Scheme: ApproxScheme,
fn approx_as_by<Dst, Scheme>(self) -> Result<Dst, Self::Err>where Self: Sized + ApproxInto<Dst, Scheme>, Scheme: ApproxScheme,
Approximate the subject to a given type with a specific scheme.
source§fn into_as<Dst>(self) -> Dstwhere
Self: Sized + Into<Dst>,
fn into_as<Dst>(self) -> Dstwhere Self: Sized + Into<Dst>,
Convert the subject to a given type.