Debian Codegraph @

src/net/tls/util.rs

raw symbols SCIP
1 use craterust-analyzer cargo sqlx-core 0.8.3 crate/::netrust-analyzer cargo sqlx-core 0.8.3 net/::Socketrust-analyzer cargo sqlx-core 0.8.3 net/socket/Socket#;
2
3 use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::{selfrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/, Readrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/Read#, Writerust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/Write#};
4 use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::taskrust-analyzer cargo std https://github.com/rust-lang/rust/library/std task/::{Contextrust-analyzer cargo core https://github.com/rust-lang/rust/library/core task/wake/Context#, Pollrust-analyzer cargo core https://github.com/rust-lang/rust/library/core task/poll/Poll#};
5
6 use futures_corerust-analyzer cargo futures-core 0.3.34 crate/::readyrust-analyzer cargo futures-core 0.3.34 task/poll/ready!;
7 use futures_utilrust-analyzer cargo futures-util 0.3.34 crate/::futurerust-analyzer cargo futures-util 0.3.34 future/;
8
9 pub struct StdSocketrust-analyzer cargo sqlx-core 0.8.3 net/tls/util/StdSocket#<S> {
10 pub socketrust-analyzer cargo sqlx-core 0.8.3 net/tls/util/StdSocket#socket.: S,
11 wants_readrust-analyzer cargo sqlx-core 0.8.3 net/tls/util/StdSocket#wants_read.: bool,
12 wants_writerust-analyzer cargo sqlx-core 0.8.3 net/tls/util/StdSocket#wants_write.: bool,
13 }
14
15 impl<S: Socketrust-analyzer cargo sqlx-core 0.8.3 net/socket/Socket#> StdSocketrust-analyzer cargo sqlx-core 0.8.3 net/tls/util/StdSocket#<S> {
16 pub fn newrust-analyzer cargo sqlx-core 0.8.3 net/tls/util/impl#[`StdSocket<S>`]new().(socket: S) -> Selfrust-analyzer cargo sqlx-core 0.8.3 net/tls/util/impl#[`StdSocket<S>`] {
17 Selfrust-analyzer cargo sqlx-core 0.8.3 net/tls/util/impl#[`StdSocket<S>`] {
18 socketrust-analyzer cargo sqlx-core 0.8.3 net/tls/util/StdSocket#socket.,
19 wants_readrust-analyzer cargo sqlx-core 0.8.3 net/tls/util/StdSocket#wants_read.: false,
20 wants_writerust-analyzer cargo sqlx-core 0.8.3 net/tls/util/StdSocket#wants_write.: false,
21 }
22 }
23
24 pub fn poll_readyrust-analyzer cargo sqlx-core 0.8.3 net/tls/util/impl#[`StdSocket<S>`]poll_ready().(&mut self, cx: &mut Contextrust-analyzer cargo core https://github.com/rust-lang/rust/library/core task/wake/Context#<'_>) -> Pollrust-analyzer cargo core https://github.com/rust-lang/rust/library/core task/poll/Poll#<iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<()>> {
25 if self.wants_writerust-analyzer cargo sqlx-core 0.8.3 net/tls/util/StdSocket#wants_write. {
26 readyrust-analyzer cargo futures-core 0.3.34 task/poll/ready!!(self.socketrust-analyzer cargo sqlx-core 0.8.3 net/tls/util/StdSocket#socket..poll_write_readyrust-analyzer cargo sqlx-core 0.8.3 net/socket/Socket#poll_write_ready().(cx))?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
27 self.wants_writerust-analyzer cargo sqlx-core 0.8.3 net/tls/util/StdSocket#wants_write. = false;
28 }
29
30 if self.wants_readrust-analyzer cargo sqlx-core 0.8.3 net/tls/util/StdSocket#wants_read. {
31 readyrust-analyzer cargo futures-core 0.3.34 task/poll/ready!!(self.socketrust-analyzer cargo sqlx-core 0.8.3 net/tls/util/StdSocket#socket..poll_read_readyrust-analyzer cargo sqlx-core 0.8.3 net/socket/Socket#poll_read_ready().(cx))?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
32 self.wants_readrust-analyzer cargo sqlx-core 0.8.3 net/tls/util/StdSocket#wants_read. = false;
33 }
34
35 Pollrust-analyzer cargo core https://github.com/rust-lang/rust/library/core task/poll/Poll#::Readyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core task/poll/Poll#Ready#(Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(()))
36 }
37
38 pub async fn readyrust-analyzer cargo sqlx-core 0.8.3 net/tls/util/impl#[`StdSocket<S>`]ready().(&mut self) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<()> {
39 futurerust-analyzer cargo futures-util 0.3.34 future/::poll_fnrust-analyzer cargo futures-util 0.3.34 future/poll_fn/poll_fn().(|cx| self.poll_readyrust-analyzer cargo sqlx-core 0.8.3 net/tls/util/impl#[`StdSocket<S>`]poll_ready().(cx)).rust-analyzer cargo futures-util 0.3.34 future/poll_fn/impl#[`PollFn<F>`][Future]poll().awaitrust-analyzer cargo futures-util 0.3.34 future/poll_fn/impl#[`PollFn<F>`][Future]poll().
40 }
41 }
42
43 impl<S: Socketrust-analyzer cargo sqlx-core 0.8.3 net/socket/Socket#> Readrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/Read# for StdSocketrust-analyzer cargo sqlx-core 0.8.3 net/tls/util/StdSocket#<S> {
44 fn readrust-analyzer cargo sqlx-core 0.8.3 net/tls/util/impl#[`StdSocket<S>`][Read]read().(&mut self, mut buf: &mut [u8]) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<usize> {
45 self.wants_readrust-analyzer cargo sqlx-core 0.8.3 net/tls/util/StdSocket#wants_read. = true;
46 let read = self.socketrust-analyzer cargo sqlx-core 0.8.3 net/tls/util/StdSocket#socket..try_readrust-analyzer cargo sqlx-core 0.8.3 net/socket/Socket#try_read().(&mut buf)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
47 self.wants_readrust-analyzer cargo sqlx-core 0.8.3 net/tls/util/StdSocket#wants_read. = false;
48
49 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(read)
50 }
51 }
52
53 impl<S: Socketrust-analyzer cargo sqlx-core 0.8.3 net/socket/Socket#> Writerust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/Write# for StdSocketrust-analyzer cargo sqlx-core 0.8.3 net/tls/util/StdSocket#<S> {
54 fn writerust-analyzer cargo sqlx-core 0.8.3 net/tls/util/impl#[`StdSocket<S>`][Write]write().(&mut self, buf: &[u8]) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<usize> {
55 self.wants_writerust-analyzer cargo sqlx-core 0.8.3 net/tls/util/StdSocket#wants_write. = true;
56 let written = self.socketrust-analyzer cargo sqlx-core 0.8.3 net/tls/util/StdSocket#socket..try_writerust-analyzer cargo sqlx-core 0.8.3 net/socket/Socket#try_write().(buf)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
57 self.wants_writerust-analyzer cargo sqlx-core 0.8.3 net/tls/util/StdSocket#wants_write. = false;
58 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(written)
59 }
60
61 fn flushrust-analyzer cargo sqlx-core 0.8.3 net/tls/util/impl#[`StdSocket<S>`][Write]flush().(&mut self) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<()> {
62 // NOTE: TCP sockets and unix sockets are both no-ops for flushes
63 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(())
64 }
65 }