feat: update a bit
parent
6db0c20c4e
commit
6f68e5e041
19
Cargo.toml
19
Cargo.toml
|
@ -1,19 +1,18 @@
|
|||
[package]
|
||||
name = "lodestone_scraper"
|
||||
version = "0.1.0"
|
||||
name = "lodestone-scraper"
|
||||
version = "1.0.0"
|
||||
authors = ["Anna Clemens <git@annaclemens.io>"]
|
||||
|
||||
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"]
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# lodestone_scraper
|
||||
# lodestone-scraper
|
||||
|
||||
A Lodestone client library.
|
||||
|
||||
|
|
12
src/error.rs
12
src/error.rs
|
@ -2,16 +2,16 @@ use reqwest::StatusCode;
|
|||
|
||||
pub type Result<T> = std::result::Result<T, Error>;
|
||||
|
||||
#[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),
|
||||
}
|
||||
|
|
|
@ -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<String> {
|
||||
pub(crate) async fn text(&self, url: Url) -> Result<String> {
|
||||
let res = self.client
|
||||
.get(url)
|
||||
.send()
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
crate enum Either<L, R> {
|
||||
pub(crate) enum Either<L, R> {
|
||||
Left(L),
|
||||
Right(R),
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue