protwrap

Check-in Differences
Login

Check-in Differences

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Difference From protwrap-0.2.1 To protwrap-0.2.2

2024-02-15
13:04
Major rewrite. Want to make it easier to be protocol-agnostic on both listener and connector end-point. check-in: 37d2147f15 user: jan tags: trunk
2023-10-03
08:35
Fix fallout from earlier rename. check-in: 5d761434aa user: jan tags: protwrap-0.2.2, trunk
08:27
Derive Debug. check-in: 8f8b1b9ae6 user: jan tags: protwrap-0.2.1, trunk
08:26
Derive Clone on ProtAddr. check-in: f941dddf9a user: jan tags: trunk

Changes to Cargo.toml.

1
2
3

4
5
6
7
8
9
10
1
2

3
4
5
6
7
8
9
10


-
+







[package]
name = "protwrap"
version = "0.2.1"
version = "0.2.2"
edition = "2021"
license = "0BSD"
categories = [ "asynchronous", "network-programming" ]
keywords = [ "network", "wrapper" ]
repository = "https://repos.qrnch.tech/pub/protwrap"
description = "Thin protocol agnostic wrapper for network applications."
exclude = [

Changes to src/lib.rs.

1
2
3

4
5
6
7
8
9
10
1
2

3
4
5
6
7
8
9
10


-
+







#![cfg_attr(docsrs, feature(doc_cfg))]

#[cfg(feature = "tok")]
#[cfg(feature = "tokio")]
#[cfg_attr(docsrs, doc(cfg(feature = "tokio")))]
pub mod tokio;

use std::fmt;
use std::str::FromStr;

#[cfg(unix)]

Changes to src/tokio.rs.

1
2
3
4
5
6
7
8
9
10

11
12
13

14
15
16
17
18
19
20
1
2
3
4
5
6
7
8
9

10
11
12

13
14
15
16
17
18
19
20









-
+


-
+







#[cfg(unix)]
use std::fs;

#[cfg(unix)]
use std::os::unix::fs::FileTypeExt;

#[cfg(unix)]
use std::path::Path;

use tok::net::{TcpListener, TcpStream};
use tokio::net::{TcpListener, TcpStream};

#[cfg(unix)]
use tok::net::{UnixListener, UnixStream};
use tokio::net::{UnixListener, UnixStream};

#[cfg(unix)]
use tokio_util::either::Either;

#[cfg(unix)]
pub type Stream = Either<TcpStream, UnixStream>;

64
65
66
67
68
69
70
71

72
73
74
75

76
77
78
79
80
81
82
64
65
66
67
68
69
70

71
72
73
74

75
76
77
78
79
80
81
82







-
+



-
+







}

#[derive(Debug)]
pub enum SockAddr {
  Std(std::net::SocketAddr),

  #[cfg(unix)]
  TokioUnix(tok::net::unix::SocketAddr)
  TokioUnix(tokio::net::unix::SocketAddr)
}

impl Listener {
  pub async fn accept(&self) -> Result<(Stream, SockAddr), tok::io::Error> {
  pub async fn accept(&self) -> Result<(Stream, SockAddr), tokio::io::Error> {
    match self {
      #[cfg(unix)]
      Listener::Unix(u) => {
        let (stream, sa) = u.accept().await?;

        let sa = SockAddr::TokioUnix(sa);

Changes to www/changelog.md.

1
2
3
4
5
6
7
8
9
10






11
12
13
14
15
16
17
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23










+
+
+
+
+
+







# Change Log

## [Unreleased]

### Added

### Changed

### Removed

## [0.2.2] - 2023-10-03

### Changed

- Fix fallout after earlier feature/dependency rename.

---

## [0.2.1] - 2023-10-03

### Changed

- `ProtAddr` derives `Clone`