feat: simplified lifetime bounds on bulk executor
This commit is contained in:
parent
c17f93f600
commit
7bc61de1c2
6
Cargo.lock
generated
6
Cargo.lock
generated
|
@ -2271,7 +2271,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "torn-api"
|
||||
version = "1.1.0"
|
||||
version = "1.1.1"
|
||||
dependencies = [
|
||||
"bon",
|
||||
"bytes",
|
||||
|
@ -2291,7 +2291,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "torn-api-codegen"
|
||||
version = "0.2.0"
|
||||
version = "0.2.1"
|
||||
dependencies = [
|
||||
"heck",
|
||||
"indexmap",
|
||||
|
@ -2304,7 +2304,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "torn-key-pool"
|
||||
version = "1.1.0"
|
||||
version = "1.1.1"
|
||||
dependencies = [
|
||||
"chrono",
|
||||
"futures",
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
[package]
|
||||
name = "torn-api-codegen"
|
||||
authors = ["Pyrit [2111649]"]
|
||||
version = "0.2.0"
|
||||
version = "0.2.1"
|
||||
edition = "2021"
|
||||
description = "Contains the v2 torn API model descriptions and codegen for the bindings"
|
||||
license-file = { workspace = true }
|
||||
|
|
|
@ -492,7 +492,7 @@ impl Path {
|
|||
self,
|
||||
ids: I,
|
||||
builder: B
|
||||
) -> impl futures::Stream<Item = (#disc_ty, Result<#response_ty, E::Error>)> + use<'e, E, S, I, B>
|
||||
) -> impl futures::Stream<Item = (#disc_ty, Result<#response_ty, E::Error>)>
|
||||
where
|
||||
I: IntoIterator<Item = #disc_ty>,
|
||||
S: #builder_mod_path::IsComplete,
|
||||
|
|
|
@ -65,21 +65,19 @@ impl Scope {
|
|||
#(#functions)*
|
||||
}
|
||||
|
||||
pub struct #bulk_name<'e, E> where
|
||||
E: crate::executor::BulkExecutor<'e>,
|
||||
pub struct #bulk_name<E> where
|
||||
E: crate::executor::BulkExecutor,
|
||||
{
|
||||
executor: E,
|
||||
marker: std::marker::PhantomData<&'e E>,
|
||||
}
|
||||
|
||||
impl<'e, E> #bulk_name<'e, E>
|
||||
impl<E> #bulk_name<E>
|
||||
where
|
||||
E: crate::executor::BulkExecutor<'e>
|
||||
E: crate::executor::BulkExecutor
|
||||
{
|
||||
pub fn new(executor: E) -> Self {
|
||||
Self {
|
||||
executor,
|
||||
marker: std::marker::PhantomData,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "torn-api"
|
||||
version = "1.1.0"
|
||||
version = "1.1.1"
|
||||
edition = "2021"
|
||||
description = "Auto-generated bindings for the v2 torn api"
|
||||
license-file = { workspace = true }
|
||||
|
@ -36,7 +36,7 @@ futures = { version = "0.3", default-features = false, features = [
|
|||
tokio = { version = "1", features = ["full"] }
|
||||
|
||||
[build-dependencies]
|
||||
torn-api-codegen = { path = "../torn-api-codegen", version = "0.2" }
|
||||
torn-api-codegen = { path = "../torn-api-codegen", version = "0.2.1" }
|
||||
syn = { workspace = true, features = ["parsing"] }
|
||||
proc-macro2 = { workspace = true }
|
||||
prettyplease = "0.2"
|
||||
|
|
|
@ -56,7 +56,7 @@ pub trait Executor: Sized {
|
|||
}
|
||||
}
|
||||
|
||||
pub trait BulkExecutor<'e>: 'e + Sized {
|
||||
pub trait BulkExecutor: Sized {
|
||||
type Error: From<serde_json::Error> + From<crate::ApiError> + Send;
|
||||
|
||||
fn execute<R>(
|
||||
|
@ -158,46 +158,46 @@ where
|
|||
}
|
||||
|
||||
#[cfg(feature = "scopes")]
|
||||
pub trait BulkExecutorExt<'e>: BulkExecutor<'e> + Sized {
|
||||
fn user_bulk(self) -> BulkUserScope<'e, Self>;
|
||||
pub trait BulkExecutorExt: BulkExecutor + Sized {
|
||||
fn user_bulk(self) -> BulkUserScope<Self>;
|
||||
|
||||
fn faction_bulk(self) -> BulkFactionScope<'e, Self>;
|
||||
fn faction_bulk(self) -> BulkFactionScope<Self>;
|
||||
|
||||
fn torn_bulk(self) -> BulkTornScope<'e, Self>;
|
||||
fn torn_bulk(self) -> BulkTornScope<Self>;
|
||||
|
||||
fn market_bulk(self) -> BulkMarketScope<'e, Self>;
|
||||
fn market_bulk(self) -> BulkMarketScope<Self>;
|
||||
|
||||
fn racing_bulk(self) -> BulkRacingScope<'e, Self>;
|
||||
fn racing_bulk(self) -> BulkRacingScope<Self>;
|
||||
|
||||
fn forum_bulk(self) -> BulkForumScope<'e, Self>;
|
||||
fn forum_bulk(self) -> BulkForumScope<Self>;
|
||||
}
|
||||
|
||||
#[cfg(feature = "scopes")]
|
||||
impl<'e, T> BulkExecutorExt<'e> for T
|
||||
impl<'e, T> BulkExecutorExt for T
|
||||
where
|
||||
T: BulkExecutor<'e> + Sized,
|
||||
T: BulkExecutor + Sized,
|
||||
{
|
||||
fn user_bulk(self) -> BulkUserScope<'e, Self> {
|
||||
fn user_bulk(self) -> BulkUserScope<Self> {
|
||||
BulkUserScope::new(self)
|
||||
}
|
||||
|
||||
fn faction_bulk(self) -> BulkFactionScope<'e, Self> {
|
||||
fn faction_bulk(self) -> BulkFactionScope<Self> {
|
||||
BulkFactionScope::new(self)
|
||||
}
|
||||
|
||||
fn torn_bulk(self) -> BulkTornScope<'e, Self> {
|
||||
fn torn_bulk(self) -> BulkTornScope<Self> {
|
||||
BulkTornScope::new(self)
|
||||
}
|
||||
|
||||
fn market_bulk(self) -> BulkMarketScope<'e, Self> {
|
||||
fn market_bulk(self) -> BulkMarketScope<Self> {
|
||||
BulkMarketScope::new(self)
|
||||
}
|
||||
|
||||
fn racing_bulk(self) -> BulkRacingScope<'e, Self> {
|
||||
fn racing_bulk(self) -> BulkRacingScope<Self> {
|
||||
BulkRacingScope::new(self)
|
||||
}
|
||||
|
||||
fn forum_bulk(self) -> BulkForumScope<'e, Self> {
|
||||
fn forum_bulk(self) -> BulkForumScope<Self> {
|
||||
BulkForumScope::new(self)
|
||||
}
|
||||
}
|
||||
|
@ -246,7 +246,7 @@ impl Executor for &ReqwestClient {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'e> BulkExecutor<'e> for &'e ReqwestClient {
|
||||
impl BulkExecutor for &ReqwestClient {
|
||||
type Error = crate::Error;
|
||||
|
||||
fn execute<R>(
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "torn-key-pool"
|
||||
version = "1.1.0"
|
||||
version = "1.1.1"
|
||||
edition = "2021"
|
||||
authors = ["Pyrit [2111649]"]
|
||||
license-file = { workspace = true }
|
||||
|
@ -14,7 +14,7 @@ postgres = ["dep:sqlx", "dep:chrono", "dep:indoc"]
|
|||
tokio-runtime = ["dep:tokio", "dep:rand", "dep:tokio-stream"]
|
||||
|
||||
[dependencies]
|
||||
torn-api = { path = "../torn-api", default-features = false, version = "1.0.1" }
|
||||
torn-api = { path = "../torn-api", default-features = false, version = "1.1.1" }
|
||||
thiserror = "2"
|
||||
|
||||
sqlx = { version = "0.8", features = [
|
||||
|
|
|
@ -560,7 +560,7 @@ where
|
|||
}
|
||||
}
|
||||
|
||||
impl<'p, S> BulkExecutor<'p> for KeyPoolExecutor<'p, S>
|
||||
impl<S> BulkExecutor for KeyPoolExecutor<'_, S>
|
||||
where
|
||||
S: KeyPoolStorage + 'static,
|
||||
{
|
||||
|
@ -631,7 +631,7 @@ where
|
|||
}
|
||||
}
|
||||
|
||||
impl<'p, S> BulkExecutor<'p> for ThrottledKeyPoolExecutor<'p, S>
|
||||
impl<S> BulkExecutor for ThrottledKeyPoolExecutor<'_, S>
|
||||
where
|
||||
S: KeyPoolStorage + 'static,
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue