From 81b5cdbf57f8df89628c1f84c40bf8c3299d5a68 Mon Sep 17 00:00:00 2001 From: Jeremy Wall Date: Fri, 6 Jan 2023 16:52:26 -0500 Subject: [PATCH] Remove the unnecessary api module --- kitchen/src/api.rs | 31 ------------------------------- kitchen/src/cli.rs | 18 +++++++++++++++++- kitchen/src/main.rs | 1 - 3 files changed, 17 insertions(+), 33 deletions(-) delete mode 100644 kitchen/src/api.rs diff --git a/kitchen/src/api.rs b/kitchen/src/api.rs deleted file mode 100644 index a274d07..0000000 --- a/kitchen/src/api.rs +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright 2022 Jeremy Wall -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#[derive(Debug)] -pub enum ParseError { - IO(std::io::Error), - Syntax(String), -} - -impl From for ParseError { - fn from(err: std::io::Error) -> Self { - ParseError::IO(err) - } -} - -impl From for ParseError { - fn from(s: String) -> Self { - ParseError::Syntax(s) - } -} diff --git a/kitchen/src/cli.rs b/kitchen/src/cli.rs index d450271..3ea1966 100644 --- a/kitchen/src/cli.rs +++ b/kitchen/src/cli.rs @@ -19,10 +19,26 @@ use std::path::Path; use csv; -use crate::api::ParseError; use recipes::{parse, IngredientAccumulator, Recipe}; use tracing::{error, info, instrument, warn}; +#[derive(Debug)] +pub enum ParseError { + IO(std::io::Error), + Syntax(String), +} + +impl From for ParseError { + fn from(err: std::io::Error) -> Self { + ParseError::IO(err) + } +} + +impl From for ParseError { + fn from(s: String) -> Self { + ParseError::Syntax(s) + } +} // TODO(jwall): We should think a little more closely about // the error modeling for this application. macro_rules! try_open { diff --git a/kitchen/src/main.rs b/kitchen/src/main.rs index cb8a490..18d7562 100644 --- a/kitchen/src/main.rs +++ b/kitchen/src/main.rs @@ -22,7 +22,6 @@ use clap::{clap_app, crate_authors, crate_version}; use tracing::{error, info, instrument, warn, Level}; use tracing_subscriber::FmtSubscriber; -pub mod api; mod cli; mod web;