1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264
// This file was generated by gir (https://github.com/gtk-rs/gir)
// from
// from gir-files (https://github.com/gtk-rs/gir-files)
// DO NOT EDIT
use glib::translate::*;
glib::wrapper! {
/// Contains metrics collected while loading a [`Message`][crate::Message] either from the
/// network or the disk cache.
///
/// Metrics are not collected by default for a [`Message`][crate::Message], you need to add the
/// flag [`MessageFlags::COLLECT_METRICS`][crate::MessageFlags::COLLECT_METRICS] to enable the feature.
///
/// Temporal metrics are expressed as a monotonic time and always start with a
/// fetch start event and finish with response end. All other events are optional.
/// An event can be 0 because it hasn't happened yet, because it's optional or
/// because the load failed before the event reached.
///
/// Size metrics are expressed in bytes and are updated while the [`Message`][crate::Message] is
/// being loaded. You can connect to different [`Message`][crate::Message] signals to get the
/// final result of every value.
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct MessageMetrics(Boxed<ffi::SoupMessageMetrics>);
match fn {
copy => |ptr| ffi::soup_message_metrics_copy(mut_override(ptr)),
free => |ptr| ffi::soup_message_metrics_free(ptr),
type_ => || ffi::soup_message_metrics_get_type(),
}
}
impl MessageMetrics {
/// Get the time immediately after the [`Message`][crate::Message] completed the
/// connection to the server. This includes the time for the proxy
/// negotiation and TLS handshake.
///
/// It will be 0 if no network connection was required to fetch the resource (a
/// persistent connection was used or resource was loaded from the local disk
/// cache).
///
/// # Returns
///
/// the connection end time
#[doc(alias = "soup_message_metrics_get_connect_end")]
#[doc(alias = "get_connect_end")]
pub fn connect_end(&mut self) -> u64 {
unsafe { ffi::soup_message_metrics_get_connect_end(self.to_glib_none_mut().0) }
}
/// Get the time immediately before the [`Message`][crate::Message] started to
/// establish the connection to the server.
///
/// It will be 0 if no network connection was required to fetch the resource (a
/// persistent connection was used or resource was loaded from the local disk
/// cache).
///
/// # Returns
///
/// the connection start time
#[doc(alias = "soup_message_metrics_get_connect_start")]
#[doc(alias = "get_connect_start")]
pub fn connect_start(&mut self) -> u64 {
unsafe { ffi::soup_message_metrics_get_connect_start(self.to_glib_none_mut().0) }
}
/// Get the time immediately after the [`Message`][crate::Message] completed the
/// domain lookup name for the resource.
///
/// It will be 0 if no domain lookup was required to fetch the resource (a
/// persistent connection was used or resource was loaded from the local disk
/// cache).
///
/// # Returns
///
/// the domain lookup end time
#[doc(alias = "soup_message_metrics_get_dns_end")]
#[doc(alias = "get_dns_end")]
pub fn dns_end(&mut self) -> u64 {
unsafe { ffi::soup_message_metrics_get_dns_end(self.to_glib_none_mut().0) }
}
/// Get the time immediately before the [`Message`][crate::Message] started the
/// domain lookup name for the resource.
///
/// It will be 0 if no domain lookup was required to fetch the resource (a
/// persistent connection was used or resource was loaded from the local disk
/// cache).
///
/// # Returns
///
/// the domain lookup start time
#[doc(alias = "soup_message_metrics_get_dns_start")]
#[doc(alias = "get_dns_start")]
pub fn dns_start(&mut self) -> u64 {
unsafe { ffi::soup_message_metrics_get_dns_start(self.to_glib_none_mut().0) }
}
/// Get the time immediately before the [`Message`][crate::Message] started to
/// fetch a resource either from a remote server or local disk cache.
///
/// # Returns
///
/// the fetch start time
#[doc(alias = "soup_message_metrics_get_fetch_start")]
#[doc(alias = "get_fetch_start")]
pub fn fetch_start(&mut self) -> u64 {
unsafe { ffi::soup_message_metrics_get_fetch_start(self.to_glib_none_mut().0) }
}
/// Get the number of bytes sent to the network for the request body.
///
/// This is the size of the body sent, after encodings are applied, so it might
/// be greater than the value returned by
/// [`request_body_size()`][Self::request_body_size()]. This value is available right
/// before [`wrote-body`][struct@crate::Message#wrote-body] signal is emitted, but you might get an
/// intermediate value if called before.
///
/// # Returns
///
/// the request body bytes sent
#[doc(alias = "soup_message_metrics_get_request_body_bytes_sent")]
#[doc(alias = "get_request_body_bytes_sent")]
pub fn request_body_bytes_sent(&mut self) -> u64 {
unsafe { ffi::soup_message_metrics_get_request_body_bytes_sent(self.to_glib_none_mut().0) }
}
/// Get the request body size in bytes. This is the size of the original body
/// given to the request before any encoding is applied.
///
/// This value is available right before [`wrote-body`][struct@crate::Message#wrote-body] signal is
/// emitted, but you might get an intermediate value if called before.
///
/// # Returns
///
/// the request body size
#[doc(alias = "soup_message_metrics_get_request_body_size")]
#[doc(alias = "get_request_body_size")]
pub fn request_body_size(&mut self) -> u64 {
unsafe { ffi::soup_message_metrics_get_request_body_size(self.to_glib_none_mut().0) }
}
/// Get the number of bytes sent to the network for the request headers.
///
/// This value is available right before [`wrote-headers`][struct@crate::Message#wrote-headers] signal
/// is emitted, but you might get an intermediate value if called before.
///
/// # Returns
///
/// the request headers bytes sent
#[doc(alias = "soup_message_metrics_get_request_header_bytes_sent")]
#[doc(alias = "get_request_header_bytes_sent")]
pub fn request_header_bytes_sent(&mut self) -> u64 {
unsafe {
ffi::soup_message_metrics_get_request_header_bytes_sent(self.to_glib_none_mut().0)
}
}
/// Get the time immediately before the [`Message`][crate::Message] started the
/// request of the resource from the server or the local disk cache.
///
/// # Returns
///
/// the request start time
#[doc(alias = "soup_message_metrics_get_request_start")]
#[doc(alias = "get_request_start")]
pub fn request_start(&mut self) -> u64 {
unsafe { ffi::soup_message_metrics_get_request_start(self.to_glib_none_mut().0) }
}
/// Get the number of bytes received from the network for the response body.
///
/// This value is available right before [`got-body`][struct@crate::Message#got-body] signal is
/// emitted, but you might get an intermediate value if called before. For
/// resources loaded from the disk cache this value is always 0.
///
/// # Returns
///
/// the response body bytes received
#[doc(alias = "soup_message_metrics_get_response_body_bytes_received")]
#[doc(alias = "get_response_body_bytes_received")]
pub fn response_body_bytes_received(&mut self) -> u64 {
unsafe {
ffi::soup_message_metrics_get_response_body_bytes_received(self.to_glib_none_mut().0)
}
}
/// Get the response body size in bytes.
///
/// This is the size of the body as given to the user after all encodings are
/// applied, so it might be greater than the value returned by
/// [`response_body_bytes_received()`][Self::response_body_bytes_received()]. This value is
/// available right before [`got-body`][struct@crate::Message#got-body] signal is emitted, but you
/// might get an intermediate value if called before.
///
/// # Returns
///
/// the response body size
#[doc(alias = "soup_message_metrics_get_response_body_size")]
#[doc(alias = "get_response_body_size")]
pub fn response_body_size(&mut self) -> u64 {
unsafe { ffi::soup_message_metrics_get_response_body_size(self.to_glib_none_mut().0) }
}
/// Get the time immediately after the [`Message`][crate::Message] received the last
/// bytes of the response from the server or the local disk cache.
///
/// In case of load failure, this returns the time immediately before the
/// fetch is aborted.
///
/// # Returns
///
/// the response end time
#[doc(alias = "soup_message_metrics_get_response_end")]
#[doc(alias = "get_response_end")]
pub fn response_end(&mut self) -> u64 {
unsafe { ffi::soup_message_metrics_get_response_end(self.to_glib_none_mut().0) }
}
/// Get the number of bytes received from the network for the response headers.
///
/// This value is available right before [`got-headers`][struct@crate::Message#got-headers] signal
/// is emitted, but you might get an intermediate value if called before.
/// For resources loaded from the disk cache this value is always 0.
///
/// # Returns
///
/// the response headers bytes received
#[doc(alias = "soup_message_metrics_get_response_header_bytes_received")]
#[doc(alias = "get_response_header_bytes_received")]
pub fn response_header_bytes_received(&mut self) -> u64 {
unsafe {
ffi::soup_message_metrics_get_response_header_bytes_received(self.to_glib_none_mut().0)
}
}
/// Get the time immediately after the [`Message`][crate::Message] received the first
/// bytes of the response from the server or the local disk cache.
///
/// # Returns
///
/// the response start time
#[doc(alias = "soup_message_metrics_get_response_start")]
#[doc(alias = "get_response_start")]
pub fn response_start(&mut self) -> u64 {
unsafe { ffi::soup_message_metrics_get_response_start(self.to_glib_none_mut().0) }
}
/// Get the time immediately before the [`Message`][crate::Message] started the
/// TLS handshake.
///
/// It will be 0 if no TLS handshake was required to fetch the resource
/// (connection was not secure, a persistent connection was used or resource was
/// loaded from the local disk cache).
///
/// # Returns
///
/// the tls start time
#[doc(alias = "soup_message_metrics_get_tls_start")]
#[doc(alias = "get_tls_start")]
pub fn tls_start(&mut self) -> u64 {
unsafe { ffi::soup_message_metrics_get_tls_start(self.to_glib_none_mut().0) }
}
}