Remove the unnecessary api module

This commit is contained in:
Jeremy Wall 2023-01-06 16:52:26 -05:00
parent 8c142711bc
commit 81b5cdbf57
3 changed files with 17 additions and 33 deletions

View File

@ -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<std::io::Error> for ParseError {
fn from(err: std::io::Error) -> Self {
ParseError::IO(err)
}
}
impl From<String> for ParseError {
fn from(s: String) -> Self {
ParseError::Syntax(s)
}
}

View File

@ -19,10 +19,26 @@ use std::path::Path;
use csv; use csv;
use crate::api::ParseError;
use recipes::{parse, IngredientAccumulator, Recipe}; use recipes::{parse, IngredientAccumulator, Recipe};
use tracing::{error, info, instrument, warn}; use tracing::{error, info, instrument, warn};
#[derive(Debug)]
pub enum ParseError {
IO(std::io::Error),
Syntax(String),
}
impl From<std::io::Error> for ParseError {
fn from(err: std::io::Error) -> Self {
ParseError::IO(err)
}
}
impl From<String> for ParseError {
fn from(s: String) -> Self {
ParseError::Syntax(s)
}
}
// TODO(jwall): We should think a little more closely about // TODO(jwall): We should think a little more closely about
// the error modeling for this application. // the error modeling for this application.
macro_rules! try_open { macro_rules! try_open {

View File

@ -22,7 +22,6 @@ use clap::{clap_app, crate_authors, crate_version};
use tracing::{error, info, instrument, warn, Level}; use tracing::{error, info, instrument, warn, Level};
use tracing_subscriber::FmtSubscriber; use tracing_subscriber::FmtSubscriber;
pub mod api;
mod cli; mod cli;
mod web; mod web;