orphanage

Check-in Differences
Login

Check-in Differences

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

Difference From orphanage-0.1.1 To orphanage-0.1.2

2024-11-07
12:44
Add setops module. check-in: 02f72ed914 user: jan tags: trunk
2024-11-01
12:52
Happy pedantic clippy. check-in: b2e5d75f49 user: jan tags: orphanage-0.1.2, trunk
12:48
Release maintenance. check-in: e924dfeeb4 user: jan tags: trunk
2024-10-28
03:42
Add object name spec string. check-in: 7716fd0685 user: jan tags: trunk
2024-10-19
13:53
Change log. check-in: 3a8934a118 user: jan tags: orphanage-0.1.1, trunk
2024-10-07
01:18
Exclude examples from publishing. check-in: d41a277a0d user: jan tags: orphanage-0.1.0, trunk

Changes to .efiles.

12
13
14
15
16
17
18

src/futures.rs
src/iox.rs
src/tokiox.rs
src/tokiox/tcpconn.rs
src/serde_parsers.rs
examples/fut_if_some.rs
examples/deser.rs








>
12
13
14
15
16
17
18
19
src/futures.rs
src/iox.rs
src/tokiox.rs
src/tokiox/tcpconn.rs
src/serde_parsers.rs
examples/fut_if_some.rs
examples/deser.rs
examples/slasher.rs

Changes to Cargo.toml.

1
2
3
4
5
6
7
8
9
10
[package]
name = "orphanage"
version = "0.1.1"
edition = "2021"
license = "0BSD"
# https://crates.io/category_slugs
categories = [ "network-programming" ]
keywords = [ "sqlite", "fs", "path" ]
repository = "https://repos.qrnch.tech/pub/orphanage"
description = "Random collection of stuff that is still searching for a home."


|







1
2
3
4
5
6
7
8
9
10
[package]
name = "orphanage"
version = "0.1.2"
edition = "2021"
license = "0BSD"
# https://crates.io/category_slugs
categories = [ "network-programming" ]
keywords = [ "sqlite", "fs", "path" ]
repository = "https://repos.qrnch.tech/pub/orphanage"
description = "Random collection of stuff that is still searching for a home."
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47

[dependencies]
async-trait = { version = "0.1.82", optional = true }
killswitch = { version = "0.4.2", optional = true }
parse-size = { version = "1.1.0", optional = true }
rand = { version = "0.8.5" }
rusqlite = { version = "0.32.1", optional = true, features = ["functions"] }
serde = { version = "1.0.210", optional = true, features = ["derive"] }
sha2 = { version = "0.10.7", optional = true }
shellexpand = { version = "3.1.0" }
tokio = { version = "1.40.0", optional = true, features = [
  "macros", "net", "time"
] }

[dev-dependencies]
killswitch = { version = "0.4.2" }
tokio = { version = "1.40.0", features = ["full"] }
tokio-test = { version = "0.4.3" }







|


|







30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47

[dependencies]
async-trait = { version = "0.1.82", optional = true }
killswitch = { version = "0.4.2", optional = true }
parse-size = { version = "1.1.0", optional = true }
rand = { version = "0.8.5" }
rusqlite = { version = "0.32.1", optional = true, features = ["functions"] }
serde = { version = "1.0.214", optional = true, features = ["derive"] }
sha2 = { version = "0.10.7", optional = true }
shellexpand = { version = "3.1.0" }
tokio = { version = "1.41.0", optional = true, features = [
  "macros", "net", "time"
] }

[dev-dependencies]
killswitch = { version = "0.4.2" }
tokio = { version = "1.40.0", features = ["full"] }
tokio-test = { version = "0.4.3" }

Added examples/slasher.rs.



















>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
use orphanage::path::win2unix_sep;

fn main() {
  let winpath = r"c:\foo\bar\baz.txt";
  let pth = win2unix_sep(winpath);
  println!("{pth:?}");
}

// vim: set ft=rust et sw=2 ts=2 sts=2 cinoptions=2 tw=79 :

Changes to src/path.rs.

129
130
131
132
133
134
135























136
137
138
139
140
141
142
      basedir.join(pth)
    }
  }

  inner(basedir, pth.as_ref())
}

























/*
/// Expand, perform action on expanded path.
pub fn expand_and<F>(input: impl AsRef<str>, f: F) -> Result<PathBuf, Error>
where
  F: FnOnce(&Path) -> Result<(), Error>
{







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
      basedir.join(pth)
    }
  }

  inner(basedir, pth.as_ref())
}


/// Replace '\` with `/` in a `PathBuf`.
///
/// On unixy platforms, `\` isn't treated a a path separator, while on Windows
/// both `\` and `/` are treated as path separators, which means that using `/`
/// on Windows is the most portable option.
///
/// The current implementation converts the path to a string, using
/// `Path::to_str()`, replaces the backslashes with slashes and then converts
/// the string back to a `PathBuf`.  An implication of this is that only paths
/// that are utf-8 compliant can be processed.
#[must_use]
#[allow(clippy::option_if_let_else)]
pub fn win2unix_sep(pth: impl AsRef<Path>) -> PathBuf {
  let pth = pth.as_ref();
  if let Some(s) = pth.to_str() {
    let converted = s.replace('\\', "/");
    PathBuf::from(converted)
  } else {
    pth.to_path_buf()
  }
}


/*
/// Expand, perform action on expanded path.
pub fn expand_and<F>(input: impl AsRef<str>, f: F) -> Result<PathBuf, Error>
where
  F: FnOnce(&Path) -> Result<(), Error>
{

Changes to src/strx.rs.

51
52
53
54
55
56
57






58
59
60
61
62
63
64
}

#[inline]
#[must_use]
pub fn is_name_char(c: char) -> bool {
  c.is_alphanumeric() || c == '_' || c == '-' || c == '.'
}







#[allow(clippy::missing_errors_doc)]
pub fn validate_name<L, R>(s: &str, lead: L, rest: R) -> Result<(), Error>
where
  L: Fn(char) -> bool,
  R: Fn(char) -> bool
{







>
>
>
>
>
>







51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
}

#[inline]
#[must_use]
pub fn is_name_char(c: char) -> bool {
  c.is_alphanumeric() || c == '_' || c == '-' || c == '.'
}


pub const OBJNAME_SPEC: &str = "must be non-empty, lead with an alphabetic \
                                character, with each following character \
                                being alphanumeric, '_', '-' or '.'";


#[allow(clippy::missing_errors_doc)]
pub fn validate_name<L, R>(s: &str, lead: L, rest: R) -> Result<(), Error>
where
  L: Fn(char) -> bool,
  R: Fn(char) -> bool
{

Changes to www/changelog.md.

1
2
3
4












5











6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# Change Log

## [Unreleased]













[Details](/vdiff?from=orphanage-0.1.0&to=trunk)












### Added

- Add `path::PathExt`, and implement it for `PathBuf`.
  - `PathBuf::expand()` expands a string to a `PathBuf` and returns it.
  - `PathBuf::expand_and()` works like `PathBuf::expand()` but it runs a
     closure on the expanded pwth before returning it.
  - `PathBuf::expand_and_canon()` works like `PathBuf::expand_and()` but it
    canonicalizes the path just before returning it.

### Changed

### Removed

---

## [0.1.0]

[Details](/vdiff?from=orphanage-0.0.4&to=orphanage-0.1.0)

### Added




>
>
>
>
>
>
>
>
>
>
>
>
|
>
>
>
>
>
>
>
>
>
>
>










<
<
<
<







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38




39
40
41
42
43
44
45
# Change Log

## [Unreleased]

[Details](/vdiff?from=orphanage-0.1.2&to=trunk)

### Added

### Changed

### Removed

---

## [0.1.2] - 2024-11-01

[Details](/vdiff?from=orphanage-0.1.1&to=orphanage-0.1.2)

### Added

- `path::win2unix_sep()` can be used to convert paths with backslashes to
  paths with slashes.

---

## [0.1.1] - 2024-10-19

[Details](/vdiff?from=orphanage-0.1.0&to=orphanage-0.1.1)

### Added

- Add `path::PathExt`, and implement it for `PathBuf`.
  - `PathBuf::expand()` expands a string to a `PathBuf` and returns it.
  - `PathBuf::expand_and()` works like `PathBuf::expand()` but it runs a
     closure on the expanded pwth before returning it.
  - `PathBuf::expand_and_canon()` works like `PathBuf::expand_and()` but it
    canonicalizes the path just before returning it.





---

## [0.1.0]

[Details](/vdiff?from=orphanage-0.0.4&to=orphanage-0.1.0)

### Added