From 24af17846d14b290aa1d90e37e98c4cbe9e173e1 Mon Sep 17 00:00:00 2001 From: pravic Date: Tue, 12 Apr 2016 18:12:52 +0300 Subject: add winapi-km-rs docs --- doc/src/km/status.rs.html | 226 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 226 insertions(+) create mode 100644 doc/src/km/status.rs.html (limited to 'doc/src/km/status.rs.html') diff --git a/doc/src/km/status.rs.html b/doc/src/km/status.rs.html new file mode 100644 index 0000000..c2fc788 --- /dev/null +++ b/doc/src/km/status.rs.html @@ -0,0 +1,226 @@ + + + + + + + + + + status.rs.html -- source + + + + + + + + + + + + + + + + + +
 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
+
+//! NT Status codes.
+#![allow(non_camel_case_types)]
+#![allow(overflowing_literals)]
+
+/// NT Status type.
+pub type NTSTATUS = Status;
+
+/// A specialized `Result` type for NT operations.
+pub type Result<T> = ::core::result::Result<T, Status>;
+
+
+/// NT Status code.
+#[repr(C)]
+#[derive(Clone, Copy)]
+pub enum Status {
+	success = 0,
+	unsuccessful = 0xC0000001,
+}
+
+impl Status {
+	/// Evaluates to `true` if the `Status` is a success type (`0..0x3FFFFFFF`)
+	/// or an informational type (`0x40000000..0x7FFFFFFF`).
+	pub fn is_ok(&self) -> bool {
+		(*self as i32) >= 0
+	}
+	/// Status is a warning or error type.
+	pub fn is_err(&self) -> bool {
+		(*self as i32) < 0
+	}
+	/// Status is a success type.
+	pub fn is_success(&self) -> bool {
+		let c = *self as u32;
+		c > 0 && c < 0x3FFF_FFFF
+	}
+	/// Status is a information type.
+	pub fn is_information(&self) -> bool {
+		let c = *self as u32;
+		c > 0x4000_0000 && c < 0x7FFF_FFFF
+	}
+	/// Status is a warning type.
+	pub fn is_warning(&self) -> bool {
+		let c = *self as u32;
+		c > 0x8000_0000 && c < 0xBFFF_FFFF
+	}
+	/// Status is a error type.
+	pub fn is_error(&self) -> bool {
+		let c = *self as u32;
+		c > 0xC000_0000 && c < 0xFFFF_FFFF
+	}
+}
+
+/// Convert `Status` to `Result<()>`.
+pub fn check(st: Status) -> Result<()> {
+	if st.is_err() {
+		Err(st)
+	} else {
+		Ok(())
+	}
+}
+
+
+ + + + + + + + + + + + + + + \ No newline at end of file -- cgit v1.2.3