summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/error.rs24
-rw-r--r--src/main.rs25
2 files changed, 49 insertions, 0 deletions
diff --git a/src/error.rs b/src/error.rs
new file mode 100644
index 0000000..7054551
--- /dev/null
+++ b/src/error.rs
@@ -0,0 +1,24 @@
+#[derive(Debug)]
+pub enum Error {
+    IO(std::io::Error),
+}
+
+impl std::error::Error for Error { }
+
+impl std::fmt::Display for Error {
+    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+        match self {
+            Error::IO(e) => e.fmt(f),
+        }
+    }
+}
+
+impl std::cmp::PartialEq for Error {
+    fn eq(&self, other: &Self) -> bool {
+        match (self, other) {
+            (Error::IO(_), Error::IO(_)) =>
+                false,
+        }
+    }
+}
+
diff --git a/src/main.rs b/src/main.rs
new file mode 100644
index 0000000..5ca6d46
--- /dev/null
+++ b/src/main.rs
@@ -0,0 +1,25 @@
+pub mod error;
+
+use error::Error;
+
+
+pub type Result<T> = std::result::Result<T, Error>;
+
+
+fn main() -> Result<()> {
+    std::process::exit(match repl() {
+        Ok(()) => 0,
+        Err(ref e) => {
+            eprintln!("{}", e);
+            1
+        }
+    })
+}
+
+
+fn repl() -> Result<()> {
+    println!("Hello, terminal!");
+
+    Ok(())
+}
+