Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit1ea9938

Browse files
committed
Use #[project(!Unpin)] instead of PhantomPinned
1 parentfc27042 commit1ea9938

File tree

5 files changed

+7
-23
lines changed

5 files changed

+7
-23
lines changed

‎tokio-postgres/Cargo.toml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ futures-util = { version = "0.3", default-features = false, features = ["sink"]
5656
log ="0.4"
5757
parking_lot ="0.12"
5858
percent-encoding ="2.0"
59-
pin-project-lite ="0.2"
59+
pin-project-lite ="0.2.11"
6060
phf ="0.13"
6161
postgres-protocol = {version ="0.6.8",path ="../postgres-protocol" }
6262
postgres-types = {version ="0.2.9",path ="../postgres-types" }

‎tokio-postgres/src/copy_in.rs‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use postgres_protocol::message::backend::Message;
1212
use postgres_protocol::message::frontend;
1313
use postgres_protocol::message::frontend::CopyData;
1414
use std::future;
15-
use std::marker::{PhantomData,PhantomPinned};
15+
use std::marker::PhantomData;
1616
use std::pin::Pin;
1717
use std::task::{ready,Context,Poll};
1818

@@ -74,14 +74,13 @@ pin_project! {
7474
///
7575
/// The copy *must* be explicitly completed via the `Sink::close` or `finish` methods. If it is
7676
/// not, the copy will be aborted.
77+
#[project(!Unpin)]
7778
pubstructCopyInSink<T>{
7879
#[pin]
7980
sender: mpsc::Sender<CopyInMessage>,
8081
responses:Responses,
8182
buf:BytesMut,
8283
state:SinkState,
83-
#[pin]
84-
_p:PhantomPinned,
8584
_p2:PhantomData<T>,
8685
}
8786
}
@@ -221,7 +220,6 @@ where
221220
responses,
222221
buf:BytesMut::new(),
223222
state:SinkState::Active,
224-
_p:PhantomPinned,
225223
_p2:PhantomData,
226224
})
227225
}

‎tokio-postgres/src/copy_out.rs‎

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ use futures_util::Stream;
77
use log::debug;
88
use pin_project_lite::pin_project;
99
use postgres_protocol::message::backend::Message;
10-
use std::marker::PhantomPinned;
1110
use std::pin::Pin;
1211
use std::task::{ready,Context,Poll};
1312

@@ -16,10 +15,7 @@ pub async fn copy_out(client: &InnerClient, statement: Statement) -> Result<Copy
1615

1716
let buf = query::encode(client,&statement,slice_iter(&[]))?;
1817
let responses =start(client, buf).await?;
19-
Ok(CopyOutStream{
20-
responses,
21-
_p:PhantomPinned,
22-
})
18+
Ok(CopyOutStream{ responses})
2319
}
2420

2521
asyncfnstart(client:&InnerClient,buf:Bytes) ->Result<Responses,Error>{
@@ -40,10 +36,9 @@ async fn start(client: &InnerClient, buf: Bytes) -> Result<Responses, Error> {
4036

4137
pin_project!{
4238
/// A stream of `COPY ... TO STDOUT` query data.
39+
#[project(!Unpin)]
4340
pubstructCopyOutStream{
4441
responses:Responses,
45-
#[pin]
46-
_p:PhantomPinned,
4742
}
4843
}
4944

‎tokio-postgres/src/query.rs‎

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ use postgres_protocol::message::backend::{CommandCompleteBody, Message};
1313
use postgres_protocol::message::frontend;
1414
use postgres_types::Type;
1515
use std::fmt;
16-
use std::marker::PhantomPinned;
1716
use std::pin::Pin;
1817
use std::sync::Arc;
1918
use std::task::{ready,Context,Poll};
@@ -57,7 +56,6 @@ where
5756
statement,
5857
responses,
5958
rows_affected:None,
60-
_p:PhantomPinned,
6159
})
6260
}
6361

@@ -95,7 +93,6 @@ where
9593
statement:Statement::unnamed(vec![],vec![]),
9694
responses,
9795
rows_affected:None,
98-
_p:PhantomPinned,
9996
});
10097
}
10198
Message::RowDescription(row_description) =>{
@@ -115,7 +112,6 @@ where
115112
statement:Statement::unnamed(vec![], columns),
116113
responses,
117114
rows_affected:None,
118-
_p:PhantomPinned,
119115
});
120116
}
121117
_ =>returnErr(Error::unexpected_message()),
@@ -140,7 +136,6 @@ pub async fn query_portal(
140136
statement: portal.statement().clone(),
141137
responses,
142138
rows_affected:None,
143-
_p:PhantomPinned,
144139
})
145140
}
146141

@@ -285,12 +280,11 @@ where
285280

286281
pin_project!{
287282
/// A stream of table rows.
283+
#[project(!Unpin)]
288284
pubstructRowStream{
289285
statement:Statement,
290286
responses:Responses,
291287
rows_affected:Option<u64>,
292-
#[pin]
293-
_p:PhantomPinned,
294288
}
295289
}
296290

‎tokio-postgres/src/simple_query.rs‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ use log::debug;
1010
use pin_project_lite::pin_project;
1111
use postgres_protocol::message::backend::Message;
1212
use postgres_protocol::message::frontend;
13-
use std::marker::PhantomPinned;
1413
use std::pin::Pin;
1514
use std::sync::Arc;
1615
use std::task::{ready,Context,Poll};
@@ -41,7 +40,6 @@ pub async fn simple_query(client: &InnerClient, query: &str) -> Result<SimpleQue
4140
Ok(SimpleQueryStream{
4241
responses,
4342
columns:None,
44-
_p:PhantomPinned,
4543
})
4644
}
4745

@@ -72,11 +70,10 @@ fn encode(client: &InnerClient, query: &str) -> Result<Bytes, Error> {
7270

7371
pin_project!{
7472
/// A stream of simple query results.
73+
#[project(!Unpin)]
7574
pubstructSimpleQueryStream{
7675
responses:Responses,
7776
columns:Option<Arc<[SimpleColumn]>>,
78-
#[pin]
79-
_p:PhantomPinned,
8077
}
8178
}
8279

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp