Commit Graph

44 Commits

Author SHA1 Message Date
Wolfgang Bumiller
fd03b808ab tools: io::read: introduce read_host_value_boxed
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-09-11 14:40:42 +02:00
Wolfgang Bumiller
5c5db5ccc1 tools: tests for static_assert_size macro
Signed-off-by: Wolfgang Bumiller <w.bumiller@errno.eu>
2019-08-23 16:47:27 +02:00
Wolfgang Bumiller
f1351e7e41 tools: add a static size assertion
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-08-23 11:26:57 +02:00
Wolfgang Bumiller
e1ebf9b67e tools: borrow: use ManuallyDrop
While Option serves a similar purpose, ManuallyDrop is an
api more directed at what we're actually doing here.
Note that Option<Box<>> is sort of guaranteed to have the
same layout as Box<> mostly due to the fact that Box<>
cannot be null, whereas ManuallyDrop is always guaranteed to
be the same layout as the inner type.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-08-22 09:53:40 +02:00
Wolfgang Bumiller
09d84f6634 [clippy] tools: lifetimes and constants
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-08-22 09:42:05 +02:00
Wolfgang Bumiller
45b5839e7e replace std::mem::uninitialized
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-08-21 16:49:12 +02:00
Wolfgang Bumiller
e59456e0b7 tools: fs: rename CreateOptions::empty to new
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-08-21 12:01:43 +02:00
Wolfgang Bumiller
47fdbc6a32 tools: fs: add create_path and CreateOptions
To allow creating paths recursively with options. (Basically
extends `std::fs::create_dir_all`.)

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-08-21 11:51:45 +02:00
Wolfgang Bumiller
aadb47a292 update nix to 0.15 for mkdirat
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-08-21 11:51:45 +02:00
Wolfgang Bumiller
4a1c914827 tools: fd: improve drop handler and add some helpers
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-08-21 11:51:45 +02:00
Wolfgang Bumiller
acbf549bf0 tools: fs: import unistd::{Uid,Gid} fully
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-08-21 10:15:21 +02:00
Wolfgang Bumiller
abc32ba70f cleanup
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-08-16 13:15:39 +02:00
Wolfgang Bumiller
2ecd147036 tools: add borrow::Tied with example docs
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-08-16 12:36:27 +02:00
Wolfgang Bumiller
ccce46eba4 formatting fixup
make fmt
(cargo fmt --all)

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-08-05 14:14:23 +02:00
Wolfgang Bumiller
863a16a5bc whitespace cleanup
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-08-05 14:13:37 +02:00
Wolfgang Bumiller
4c9a8b5c88 cleanup use statements
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-08-05 14:12:49 +02:00
Wolfgang Bumiller
63b17d4eb5 tools: Cargo.toml: cleanup
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-08-05 12:36:35 +02:00
Wolfgang Bumiller
97f41473db rename tools::raw to tools::fd
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-08-05 12:36:24 +02:00
Dietmar Maurer
3497f97a7d proxmox-tools/src/lib.rs: fix doc test 2019-08-05 10:12:08 +02:00
Wolfgang Bumiller
d78142302c formatting fixup
add #[rustfmt::skip] to our macros...

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-08-05 09:45:14 +02:00
Dietmar Maurer
d6d65be42e add nodename helper (copied from proxmox-backup) 2019-08-03 17:00:02 +02:00
Dietmar Maurer
51d891af5d new helper create_dir_chown
moved from proxmox-backup.
2019-08-03 12:21:20 +02:00
Dietmar Maurer
9f63a6506e src/fs.rs: new module for fs related helpers 2019-08-03 11:49:14 +02:00
Wolfgang Bumiller
26e4b205ac tools: add remaining common regexps
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-07-31 11:45:45 +02:00
Wolfgang Bumiller
1bc52e2482 tools: add common_regex with IP_REGEX for now
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-07-31 11:45:22 +02:00
Wolfgang Bumiller
da40267188 api-server, tools: formatting cleanup
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-07-18 10:47:56 +02:00
Wolfgang Bumiller
3f8feff618 tools: actually add raw module
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-07-17 12:12:08 +02:00
Wolfgang Bumiller
404256a646 tools: add raw::Fd
to replace proxmox_backup's tools::Fd

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-07-02 15:47:37 +02:00
Wolfgang Bumiller
7efc037717 make valgrind opt-in, not opt-out
otherwise this crate cannot be compiled without nightly as
valgrind_request requires feature(asm)

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-07-02 15:23:32 +02:00
Wolfgang Bumiller
3111d615b8 tools: move vec::ops::* to vec::ByteVecExt
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-07-01 11:00:29 +02:00
Wolfgang Bumiller
e290d78840 remove deprecated tools::io::ops reexport
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-07-01 10:56:27 +02:00
Wolfgang Bumiller
3310c5e05d tools: add io::WriteExt
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-07-01 10:25:15 +02:00
Wolfgang Bumiller
9e7dfce827 tools: change tools::io::ops::*:
We'll stick to existing naming conventions and provide:
    tools::io::{ReadExt, WriteExt}

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-07-01 09:55:08 +02:00
Wolfgang Bumiller
dbcadda6b2 tools: add doc tests for bin_to_hex, hex_to_bin
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-06-19 14:14:54 +02:00
Wolfgang Bumiller
4b2f3d3284 tools: add doc-test for bytes_as_base64
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-06-18 12:13:12 +02:00
Wolfgang Bumiller
be6d9fb6ab tools: make date_time_as_rfc3339 work for all TimeZones
and add a doc-test passing `cargo test`
(and formatting fixup)

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-06-18 12:11:23 +02:00
Wolfgang Bumiller
099efb2da5 formatting fixup
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-06-18 11:47:26 +02:00
Dietmar Maurer
d966061f54 src/serde.rs: add serde helpers 2019-06-18 10:23:06 +02:00
Wolfgang Bumiller
a5af6eedf7 formatting fixup
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-06-17 12:32:42 +02:00
Dietmar Maurer
64d9e81c76 src/lib.rs: add hex_to_bin and bin_to_hex 2019-06-17 10:59:59 +02:00
Dietmar Maurer
f2716a0d26 add hex_to_digest and digest_to_hex 2019-06-14 11:27:40 +02:00
Dietmar Maurer
d7fbee66e3 proxmox-tools/src/lib.rs: implement offsetof 2019-06-14 09:57:18 +02:00
Wolfgang Bumiller
3dd6cd3fe0 formatting fixup
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-06-07 12:03:17 +02:00
Wolfgang Bumiller
2e6520a987 initial import, starting with vec & io helpers
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-06-06 14:00:25 +02:00