diff --git a/Cargo.toml b/Cargo.toml index a925c01..a4cdd0b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,19 +1,18 @@ [package] -name = "lodestone_scraper" -version = "0.1.0" +name = "lodestone-scraper" +version = "1.0.0" authors = ["Anna Clemens "] -edition = "2018" +edition = "2021" [dependencies] -reqwest = "0.10" -failure = "0.1" -# futures = "0.3" +reqwest = { version = "0.11", default-features = false, features = ["rustls-tls"] } +thiserror = "1" lazy_static = "1" url = "2" -[dependencies.lodestone_parser] -git = "https://github.com/jkcclemens/lodestone_parser" +[dependencies.lodestone-parser] +git = "https://git.annaclemens.io/ascclemens/lodestone-parser.git" [dependencies.ffxiv_types] version = "1" @@ -21,5 +20,5 @@ default-features = false features = ["worlds", "data_centers", "races", "clans"] [dependencies.tokio] -version = "0.2" -features = ["rt-core", "rt-threaded", "macros"] +version = "1" +features = ["rt-multi-thread", "macros"] diff --git a/README.md b/README.md index 9352d7f..8934376 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# lodestone_scraper +# lodestone-scraper A Lodestone client library. diff --git a/src/error.rs b/src/error.rs index 9aa87b4..d6eca90 100644 --- a/src/error.rs +++ b/src/error.rs @@ -2,16 +2,16 @@ use reqwest::StatusCode; pub type Result = std::result::Result; -#[derive(Debug, Fail)] +#[derive(Debug, thiserror::Error)] pub enum Error { - #[fail(display = "not found")] + #[error("not found")] NotFound, - #[fail(display = "lodestone responded with an unexpected code: {}", _0)] + #[error("lodestone responded with an unexpected code: {0}")] UnexpectedResponse(StatusCode), - #[fail(display = "network error: {}", _0)] + #[error("network error: {0}")] Net(reqwest::Error), - #[fail(display = "url parse error: {}", _0)] + #[error("url parse error: {0}")] Url(url::ParseError), - #[fail(display = "lodestone parse error: {}", _0)] + #[error("lodestone parse error: {0}")] Parse(lodestone_parser::error::Error), } diff --git a/src/lib.rs b/src/lib.rs index bae0f22..f1f3cfb 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,6 +1,4 @@ -#![feature(crate_visibility_modifier)] - -#[macro_use] extern crate failure; +pub extern crate lodestone_parser; use lazy_static::lazy_static; @@ -18,7 +16,7 @@ use std::str::FromStr; pub mod builder; pub mod error; pub mod models; -crate mod util; +pub(crate) mod util; use crate::error::*; @@ -43,7 +41,7 @@ impl LodestoneScraper { LODESTONE_URL.join(s).map_err(Error::Url) } - crate async fn text(&self, url: Url) -> Result { + pub(crate) async fn text(&self, url: Url) -> Result { let res = self.client .get(url) .send() diff --git a/src/util.rs b/src/util.rs index cae8c97..ed10500 100644 --- a/src/util.rs +++ b/src/util.rs @@ -1,5 +1,5 @@ -crate mod as_lodestone; -crate mod either; +pub(crate) mod as_lodestone; +pub(crate) mod either; -crate use self::as_lodestone::AsLodestone; -crate use self::either::Either; +pub(crate) use self::as_lodestone::AsLodestone; +pub(crate) use self::either::Either; diff --git a/src/util/as_lodestone.rs b/src/util/as_lodestone.rs index c4d1506..0b3db9a 100644 --- a/src/util/as_lodestone.rs +++ b/src/util/as_lodestone.rs @@ -7,7 +7,7 @@ use lodestone_parser::models::{ character::Job, }; -crate trait AsLodestone { +pub(crate) trait AsLodestone { type Representation; fn as_lodestone(&self) -> Self::Representation; @@ -81,6 +81,8 @@ impl AsLodestone for Job { Job::BlueMage => 36, Job::Gunbreaker => 37, Job::Dancer => 38, + Job::Reaper => 39, + Job::Sage => 40, } } } diff --git a/src/util/either.rs b/src/util/either.rs index 4c0e333..c544a15 100644 --- a/src/util/either.rs +++ b/src/util/either.rs @@ -1,4 +1,4 @@ -crate enum Either { +pub(crate) enum Either { Left(L), Right(R), }