diff options
| author | Linus Färnstrand <linus@mullvad.net> | 2017-02-28 18:38:33 +0100 |
|---|---|---|
| committer | Linus Färnstrand <linus@mullvad.net> | 2017-03-02 14:41:18 +0100 |
| commit | 4e70255dee3ad16a6bb99ebe4bba0460121702a3 (patch) | |
| tree | 471c26aa0b9253de6fecf0054334da14729d315a /talpid_openvpn_plugin | |
| parent | 0264d28adee81f279934f243da9e4774caed4e9e (diff) | |
| download | mullvadvpn-4e70255dee3ad16a6bb99ebe4bba0460121702a3.tar.xz mullvadvpn-4e70255dee3ad16a6bb99ebe4bba0460121702a3.zip | |
Add rustdoc to event enum
Diffstat (limited to 'talpid_openvpn_plugin')
| -rw-r--r-- | talpid_openvpn_plugin/src/ffi/consts.rs | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/talpid_openvpn_plugin/src/ffi/consts.rs b/talpid_openvpn_plugin/src/ffi/consts.rs index 18473dbc07..c7cddfd279 100644 --- a/talpid_openvpn_plugin/src/ffi/consts.rs +++ b/talpid_openvpn_plugin/src/ffi/consts.rs @@ -12,6 +12,7 @@ error_chain!{ } } +/// Enum whose variants correspond to the OPENVPN_PLUGIN_* event constants. #[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)] pub enum OpenVpnPluginEvent { Up = 0, @@ -31,6 +32,7 @@ pub enum OpenVpnPluginEvent { } impl OpenVpnPluginEvent { + /// Tries to parse an integer from C into a variant of `OpenVpnPluginEvent`. pub fn from_int(i: c_int) -> Result<OpenVpnPluginEvent> { if i >= OpenVpnPluginEvent::Up as c_int && i <= OpenVpnPluginEvent::N as c_int { Ok(unsafe { ::std::mem::transmute_copy::<c_int, OpenVpnPluginEvent>(&i) }) @@ -49,6 +51,7 @@ pub const OPENVPN_PLUGIN_FUNC_ERROR: c_int = 1; pub const OPENVPN_PLUGIN_FUNC_DEFERRED: c_int = 2; + #[cfg(test)] mod tests { use super::*; |
