libpq/ping/
mod.rs

1#[derive(Clone, Copy, Debug, Eq, PartialEq)]
2pub enum Status {
3    /** The server is running and appears to be accepting connections. */
4    Ok,
5    /**
6     * The server is running but is in a state that disallows connections (startup, shutdown, or
7     * crash recovery).
8     */
9    Reject,
10    /**
11     * The server could not be contacted. This might indicate that the server is not running, or
12     * that there is something wrong with the given connection parameters (for example, wrong port
13     * number), or that there is a network connectivity problem (for example, a firewall blocking
14     * the connection request).
15     */
16    NoResponse,
17    /**
18     * No attempt was made to contact the server, because the supplied parameters were obviously
19     * incorrect or there was some client-side problem (for example, out of memory).
20     */
21    NoAttempt,
22}
23
24#[doc(hidden)]
25impl From<pq_sys::PGPing> for Status {
26    fn from(status: pq_sys::PGPing) -> Self {
27        match status {
28            pq_sys::PGPing::PQPING_OK => Self::Ok,
29            pq_sys::PGPing::PQPING_REJECT => Self::Reject,
30            pq_sys::PGPing::PQPING_NO_RESPONSE => Self::NoResponse,
31            pq_sys::PGPing::PQPING_NO_ATTEMPT => Self::NoAttempt,
32        }
33    }
34}