]> git.lizzy.rs Git - rust.git/commitdiff
Use method rather than public field
authorEthan Brierley <ethanboxx@gmail.com>
Wed, 7 Nov 2018 08:35:28 +0000 (08:35 +0000)
committerEthan Brierley <ethanboxx@gmail.com>
Wed, 7 Nov 2018 08:35:28 +0000 (08:35 +0000)
src/libcore/num/mod.rs

index a7b6d719c6a011110f95663fb147e27998dcb261..e297050f1f04e37d1b1f24c1fc169ca30dcca94a 100644 (file)
@@ -4768,8 +4768,7 @@ fn from_str_radix<T: FromStrRadixHelper>(src: &str, radix: u32) -> Result<T, Par
 #[derive(Debug, Clone, PartialEq, Eq)]
 #[stable(feature = "rust1", since = "1.0.0")]
 pub struct ParseIntError {
-    /// Stores the cause of parsing an integer failing
-    pub kind: IntErrorKind,
+    kind: IntErrorKind,
 }
 
 /// Enum to store the various types of errors that can cause parsing an integer to fail.
@@ -4796,6 +4795,10 @@ pub enum IntErrorKind {
 }
 
 impl ParseIntError {
+    /// Outputs the detailed cause of parsing an integer failing.
+    pub fn kind(self) -> IntErrorKind {
+        self.kind
+    }
     #[unstable(feature = "int_error_internals",
                reason = "available through Error trait and this method should \
                          not be exposed publicly",