]> git.lizzy.rs Git - rust.git/commitdiff
Move spawn errors into executor.rs
authorJosef Reinhard Brandl <mail@josefbrandl.de>
Tue, 26 Jun 2018 19:13:36 +0000 (21:13 +0200)
committerJosef Reinhard Brandl <mail@josefbrandl.de>
Tue, 26 Jun 2018 19:13:36 +0000 (21:13 +0200)
src/libcore/task/executor.rs
src/libcore/task/mod.rs
src/libcore/task/spawn_error.rs [deleted file]

index fcef6d5ffc84d135d09a29bdc712e15ef952c498..73bf80d2f9997782ab3c5324f77d82685d8eed10 100644 (file)
@@ -12,7 +12,8 @@
             reason = "futures in libcore are unstable",
             issue = "50547")]
 
-use super::{TaskObj, SpawnObjError, SpawnErrorKind};
+use fmt;
+use super::{TaskObj, LocalTaskObj};
 
 /// A task executor.
 ///
@@ -42,3 +43,48 @@ fn status(&self) -> Result<(), SpawnErrorKind> {
         Ok(())
     }
 }
+
+/// Provides the reason that an executor was unable to spawn.
+pub struct SpawnErrorKind {
+    _hidden: (),
+}
+
+impl fmt::Debug for SpawnErrorKind {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        f.debug_tuple("SpawnErrorKind")
+            .field(&"shutdown")
+            .finish()
+    }
+}
+
+impl SpawnErrorKind {
+    /// Spawning is failing because the executor has been shut down.
+    pub fn shutdown() -> SpawnErrorKind {
+        SpawnErrorKind { _hidden: () }
+    }
+
+    /// Check whether this error is the `shutdown` error.
+    pub fn is_shutdown(&self) -> bool {
+        true
+    }
+}
+
+/// The result of a failed spawn
+#[derive(Debug)]
+pub struct SpawnObjError {
+    /// The kind of error
+    pub kind: SpawnErrorKind,
+
+    /// The task for which spawning was attempted
+    pub task: TaskObj,
+}
+
+/// The result of a failed spawn
+#[derive(Debug)]
+pub struct SpawnLocalObjError {
+    /// The kind of error
+    pub kind: SpawnErrorKind,
+
+    /// The task for which spawning was attempted
+    pub task: LocalTaskObj,
+}
index 36370b6b37c3d6ba83f07cc037bca44519e0c9ff..d167a37410553081101572465c41fc625583d1ec 100644 (file)
 pub use self::context::Context;
 
 mod executor;
-pub use self::executor::Executor;
+pub use self::executor::{
+  Executor, SpawnErrorKind, SpawnObjError, SpawnLocalObjError
+};
 
 mod poll;
 pub use self::poll::Poll;
 
-mod spawn_error;
-pub use self::spawn_error::{SpawnErrorKind, SpawnObjError, SpawnLocalObjError};
-
 mod task;
 pub use self::task::{TaskObj, LocalTaskObj, UnsafeTask};
 
diff --git a/src/libcore/task/spawn_error.rs b/src/libcore/task/spawn_error.rs
deleted file mode 100644 (file)
index 42d37ef..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#![unstable(feature = "futures_api",
-            reason = "futures in libcore are unstable",
-            issue = "50547")]
-
-use fmt;
-use mem;
-use super::{TaskObj, LocalTaskObj};
-
-/// Provides the reason that an executor was unable to spawn.
-pub struct SpawnErrorKind {
-    _hidden: (),
-}
-
-impl fmt::Debug for SpawnErrorKind {
-    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        f.debug_tuple("SpawnErrorKind")
-            .field(&"shutdown")
-            .finish()
-    }
-}
-
-impl SpawnErrorKind {
-    /// Spawning is failing because the executor has been shut down.
-    pub fn shutdown() -> SpawnErrorKind {
-        SpawnErrorKind { _hidden: () }
-    }
-
-    /// Check whether this error is the `shutdown` error.
-    pub fn is_shutdown(&self) -> bool {
-        true
-    }
-}
-
-/// The result of a failed spawn
-#[derive(Debug)]
-pub struct SpawnObjError {
-    /// The kind of error
-    pub kind: SpawnErrorKind,
-
-    /// The task for which spawning was attempted
-    pub task: TaskObj,
-}
-
-/// The result of a failed spawn
-#[derive(Debug)]
-pub struct SpawnLocalObjError {
-    /// The kind of error
-    pub kind: SpawnErrorKind,
-
-    /// The task for which spawning was attempted
-    pub task: LocalTaskObj,
-}