Skip to main content

SpeedTestResult

Struct SpeedTestResult 

Source
pub struct SpeedTestResult {
    pub bytes_received: usize,
    pub bytes_sent: usize,
    pub download_bps: f64,
    pub upload_bps: f64,
    pub download_mbps: f64,
    pub upload_mbps: f64,
    pub ping_ms: f64,
    pub client: ClientInfo,
    pub server: ServerInfo,
    pub share: Option<Value>,
    pub timestamp: String,
}
Expand description

A processed and cached speedtest result ready for API serving.

This struct stores speeds both in bits per second and megabits per second, along with ping and metadata about client/server.

It is used to cache and respond with speedtest data efficiently.

§Examples

use speedtest_statuspage::models::{SpeedTestResult, ClientInfo, ServerInfo};

let result = SpeedTestResult {
    bytes_received: 12345678,
    bytes_sent: 87654321,
    download_bps: 50000000.0,
    upload_bps: 10000000.0,
    download_mbps: 50.0,
    upload_mbps: 10.0,
    ping_ms: 20.0,
    client: ClientInfo {
        country: "UK".to_string(),
        ip: "192.0.2.1".to_string(),
        isp: "Example ISP".to_string(),
        ispdlavg: "50".to_string(),
        isprating: "4".to_string(),
        ispulavg: "10".to_string(),
        lat: "51.5074".to_string(),
        loggedin: "false".to_string(),
        lon: "-0.1278".to_string(),
        rating: "4.5".to_string(),
    },
    server: ServerInfo {
        cc: "GB".to_string(),
        country: "United Kingdom".to_string(),
        d: 5.0,
        host: "speedtest.example.com".to_string(),
        id: "12345".to_string(),
        lat: "51.5074".to_string(),
        latency: 10.5,
        lon: "-0.1278".to_string(),
        name: "London Server".to_string(),
        sponsor: "Example Sponsor".to_string(),
        url: "http://speedtest.example.com".to_string(),
    },
    share: None,
    timestamp: "2025-08-07T12:00:00Z".to_string(),
};

assert_eq!(result.download_mbps, 50.0);
assert_eq!(result.client.isp, "Example ISP");

Fields§

§bytes_received: usize

Number of bytes received.

§bytes_sent: usize

Number of bytes sent.

§download_bps: f64

Download speed in bits per second.

§upload_bps: f64

Upload speed in bits per second.

§download_mbps: f64

Download speed in megabits per second.

§upload_mbps: f64

Upload speed in megabits per second.

§ping_ms: f64

Ping time in milliseconds.

§client: ClientInfo

Client information.

§server: ServerInfo

Server information.

§share: Option<Value>

Optional share data from the speedtest service.

§timestamp: String

Timestamp of the speedtest.

Trait Implementations§

Source§

impl Clone for SpeedTestResult

Source§

fn clone(&self) -> SpeedTestResult

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for SpeedTestResult

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for SpeedTestResult

Source§

fn default() -> SpeedTestResult

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for SpeedTestResult

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for SpeedTestResult

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more