feat: update a bit

This commit is contained in:
Anna 2022-06-16 10:12:13 -04:00
parent 6db0c20c4e
commit 6f68e5e041
Signed by: anna
GPG Key ID: 0B391D8F06FCD9E0
7 changed files with 27 additions and 28 deletions

View File

@ -1,19 +1,18 @@
[package] [package]
name = "lodestone_scraper" name = "lodestone-scraper"
version = "0.1.0" version = "1.0.0"
authors = ["Anna Clemens <git@annaclemens.io>"] authors = ["Anna Clemens <git@annaclemens.io>"]
edition = "2018" edition = "2021"
[dependencies] [dependencies]
reqwest = "0.10" reqwest = { version = "0.11", default-features = false, features = ["rustls-tls"] }
failure = "0.1" thiserror = "1"
# futures = "0.3"
lazy_static = "1" lazy_static = "1"
url = "2" url = "2"
[dependencies.lodestone_parser] [dependencies.lodestone-parser]
git = "https://github.com/jkcclemens/lodestone_parser" git = "https://git.annaclemens.io/ascclemens/lodestone-parser.git"
[dependencies.ffxiv_types] [dependencies.ffxiv_types]
version = "1" version = "1"
@ -21,5 +20,5 @@ default-features = false
features = ["worlds", "data_centers", "races", "clans"] features = ["worlds", "data_centers", "races", "clans"]
[dependencies.tokio] [dependencies.tokio]
version = "0.2" version = "1"
features = ["rt-core", "rt-threaded", "macros"] features = ["rt-multi-thread", "macros"]

View File

@ -1,4 +1,4 @@
# lodestone_scraper # lodestone-scraper
A Lodestone client library. A Lodestone client library.

View File

@ -2,16 +2,16 @@ use reqwest::StatusCode;
pub type Result<T> = std::result::Result<T, Error>; pub type Result<T> = std::result::Result<T, Error>;
#[derive(Debug, Fail)] #[derive(Debug, thiserror::Error)]
pub enum Error { pub enum Error {
#[fail(display = "not found")] #[error("not found")]
NotFound, NotFound,
#[fail(display = "lodestone responded with an unexpected code: {}", _0)] #[error("lodestone responded with an unexpected code: {0}")]
UnexpectedResponse(StatusCode), UnexpectedResponse(StatusCode),
#[fail(display = "network error: {}", _0)] #[error("network error: {0}")]
Net(reqwest::Error), Net(reqwest::Error),
#[fail(display = "url parse error: {}", _0)] #[error("url parse error: {0}")]
Url(url::ParseError), Url(url::ParseError),
#[fail(display = "lodestone parse error: {}", _0)] #[error("lodestone parse error: {0}")]
Parse(lodestone_parser::error::Error), Parse(lodestone_parser::error::Error),
} }

View File

@ -1,6 +1,4 @@
#![feature(crate_visibility_modifier)] pub extern crate lodestone_parser;
#[macro_use] extern crate failure;
use lazy_static::lazy_static; use lazy_static::lazy_static;
@ -18,7 +16,7 @@ use std::str::FromStr;
pub mod builder; pub mod builder;
pub mod error; pub mod error;
pub mod models; pub mod models;
crate mod util; pub(crate) mod util;
use crate::error::*; use crate::error::*;
@ -43,7 +41,7 @@ impl LodestoneScraper {
LODESTONE_URL.join(s).map_err(Error::Url) LODESTONE_URL.join(s).map_err(Error::Url)
} }
crate async fn text(&self, url: Url) -> Result<String> { pub(crate) async fn text(&self, url: Url) -> Result<String> {
let res = self.client let res = self.client
.get(url) .get(url)
.send() .send()

View File

@ -1,5 +1,5 @@
crate mod as_lodestone; pub(crate) mod as_lodestone;
crate mod either; pub(crate) mod either;
crate use self::as_lodestone::AsLodestone; pub(crate) use self::as_lodestone::AsLodestone;
crate use self::either::Either; pub(crate) use self::either::Either;

View File

@ -7,7 +7,7 @@ use lodestone_parser::models::{
character::Job, character::Job,
}; };
crate trait AsLodestone { pub(crate) trait AsLodestone {
type Representation; type Representation;
fn as_lodestone(&self) -> Self::Representation; fn as_lodestone(&self) -> Self::Representation;
@ -81,6 +81,8 @@ impl AsLodestone for Job {
Job::BlueMage => 36, Job::BlueMage => 36,
Job::Gunbreaker => 37, Job::Gunbreaker => 37,
Job::Dancer => 38, Job::Dancer => 38,
Job::Reaper => 39,
Job::Sage => 40,
} }
} }
} }

View File

@ -1,4 +1,4 @@
crate enum Either<L, R> { pub(crate) enum Either<L, R> {
Left(L), Left(L),
Right(R), Right(R),
} }