Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove redundant lifetime bound #1148

Merged
merged 2 commits into from
Oct 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions postgres/src/execute/async_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ where

impl<'c, C> Execute<&'c C> for StatementNamed<'_>
where
C: Prepare + 'c,
C: Prepare,
{
type ExecuteOutput = ResultFuture<IntoGuardedFuture<'c, C>>;
type QueryOutput = Self::ExecuteOutput;
Expand Down Expand Up @@ -117,7 +117,7 @@ where

impl<'c, C, P> Execute<&'c C> for StatementUnnamedBind<'_, P>
where
C: Prepare + 'c,
C: Prepare,
P: AsParams,
{
type ExecuteOutput = ResultFuture<RowAffected>;
Expand All @@ -138,7 +138,7 @@ where

impl<'c, C> Execute<&'c C> for &std::path::Path
where
C: Query + Sync + 'c,
C: Query + Sync,
{
type ExecuteOutput = BoxedFuture<'c, Result<u64, Error>>;
type QueryOutput = BoxedFuture<'c, Result<RowSimpleStream, Error>>;
Expand Down
4 changes: 2 additions & 2 deletions postgres/src/execute/sync_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ where

impl<'c, C> ExecuteBlocking<&'c C> for StatementNamed<'_>
where
C: Prepare + 'c,
C: Prepare,
{
type ExecuteOutput = Result<StatementGuarded<'c, C>, Error>;
type QueryOutput = Self::ExecuteOutput;
Expand Down Expand Up @@ -90,7 +90,7 @@ where

impl<'c, C, P> ExecuteBlocking<&'c C> for StatementUnnamedBind<'_, P>
where
C: Prepare + 'c,
C: Prepare,
P: AsParams,
{
type ExecuteOutput = Result<u64, Error>;
Expand Down
3 changes: 2 additions & 1 deletion postgres/src/pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ impl Pool {

/// try to get a connection from pool.
/// when pool is empty it will try to spawn new connection to database and if the process failed the outcome will
/// return as [Error]
/// return as [`Error`]
pub async fn get(&self) -> Result<PoolConnection<'_>, Error> {
let _permit = self.permits.acquire().await.expect("Semaphore must not be closed");
let conn = match self.conn.lock().unwrap().pop_front() {
Expand All @@ -94,6 +94,7 @@ impl Pool {
})
}

#[cold]
#[inline(never)]
fn connect(&self) -> BoxedFuture<'_, Result<PoolClient, Error>> {
Box::pin(async move {
Expand Down
6 changes: 3 additions & 3 deletions web/src/handler/sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,7 @@ use xitca_service::{fn_build, FnService, Service};
/// ```
///
/// [handler_service]: super::handler_service
pub fn handler_sync_service<Arg, F, T, O>(
func: F,
) -> FnService<impl Fn(Arg) -> Ready<Result<HandlerServiceSync<F, T, O>, Infallible>>>
pub fn handler_sync_service<Arg, F, T, O>(func: F) -> FnService<impl Fn(Arg) -> Ready<FnServiceOutput<F, T, O>>>
where
F: Closure<T> + Send + Clone,
{
Expand All @@ -52,6 +50,8 @@ where
})
}

type FnServiceOutput<F, T, O> = Result<HandlerServiceSync<F, T, O>, Infallible>;

pub struct HandlerServiceSync<F, T, O> {
func: F,
_p: PhantomData<(T, O)>,
Expand Down
Loading