mirror of
https://github.com/haileys/bark
synced 2024-11-10 05:54:15 +00:00
rework for esp-pbuf crate
This commit is contained in:
parent
7f370a64b3
commit
d564a207ae
7 changed files with 556 additions and 96 deletions
522
Cargo.lock
generated
522
Cargo.lock
generated
|
@ -11,6 +11,15 @@ dependencies = [
|
|||
"memchr",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "aligned"
|
||||
version = "0.4.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "80a21b9440a626c7fc8573a9e3d3a06b75c7c97754c2949bc7857b90353ca655"
|
||||
dependencies = [
|
||||
"as-slice",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "alsa"
|
||||
version = "0.7.1"
|
||||
|
@ -33,6 +42,21 @@ dependencies = [
|
|||
"pkg-config",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "android-tzdata"
|
||||
version = "0.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0"
|
||||
|
||||
[[package]]
|
||||
name = "android_system_properties"
|
||||
version = "0.1.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311"
|
||||
dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ansi_term"
|
||||
version = "0.12.1"
|
||||
|
@ -42,6 +66,21 @@ dependencies = [
|
|||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "anyhow"
|
||||
version = "1.0.75"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a4668cab20f66d8d020e1fbc0ebe47217433c1b6c8f2040faf858554e394ace6"
|
||||
|
||||
[[package]]
|
||||
name = "as-slice"
|
||||
version = "0.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "516b6b4f0e40d50dcda9365d53964ec74560ad4284da2e7fc97122cd83174516"
|
||||
dependencies = [
|
||||
"stable_deref_trait",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "atty"
|
||||
version = "0.2.14"
|
||||
|
@ -88,6 +127,29 @@ dependencies = [
|
|||
"bitflags 2.4.0",
|
||||
"bytemuck",
|
||||
"derive_more",
|
||||
"esp-pbuf",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "bindgen"
|
||||
version = "0.63.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "36d860121800b2a9a94f9b5604b332d5cffb234ce17609ea479d723dbc9d3885"
|
||||
dependencies = [
|
||||
"bitflags 1.3.2",
|
||||
"cexpr",
|
||||
"clang-sys",
|
||||
"lazy_static",
|
||||
"lazycell",
|
||||
"log",
|
||||
"peeking_take_while",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"regex",
|
||||
"rustc-hash",
|
||||
"shlex",
|
||||
"syn 1.0.109",
|
||||
"which",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -125,6 +187,29 @@ dependencies = [
|
|||
"bytemuck",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "bstr"
|
||||
version = "1.6.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6798148dccfbff0fae41c7574d2fa8f1ef3492fba0face179de5d8d447d67b05"
|
||||
dependencies = [
|
||||
"memchr",
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "build-time"
|
||||
version = "0.1.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f1219c19fc29b7bfd74b7968b420aff5bc951cf517800176e795d6b2300dd382"
|
||||
dependencies = [
|
||||
"chrono",
|
||||
"once_cell",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.28",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "bumpalo"
|
||||
version = "3.13.0"
|
||||
|
@ -157,6 +242,38 @@ version = "1.4.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "89b2fd2a0dcf38d7971e2194b6b6eebab45ae01067456a7fd93d5547a61b70be"
|
||||
|
||||
[[package]]
|
||||
name = "camino"
|
||||
version = "1.1.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c59e92b5a388f549b863a7bea62612c09f24c8393560709a54558a9abdfb3b9c"
|
||||
dependencies = [
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cargo-platform"
|
||||
version = "0.1.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2cfa25e60aea747ec7e1124f238816749faa93759c6ff5b31f1ccdda137f4479"
|
||||
dependencies = [
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cargo_metadata"
|
||||
version = "0.15.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "eee4243f1f26fc7a42710e7439c149e2b10b05472f88090acce52632f231a73a"
|
||||
dependencies = [
|
||||
"camino",
|
||||
"cargo-platform",
|
||||
"semver",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"thiserror",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cc"
|
||||
version = "1.0.82"
|
||||
|
@ -188,6 +305,18 @@ version = "1.0.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
||||
|
||||
[[package]]
|
||||
name = "chrono"
|
||||
version = "0.4.31"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7f2c685bad3eb3d45a01354cedb7d5faa66194d1d58ba6e267a8de788f79db38"
|
||||
dependencies = [
|
||||
"android-tzdata",
|
||||
"iana-time-zone",
|
||||
"num-traits",
|
||||
"windows-targets 0.48.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "clang-sys"
|
||||
version = "1.6.1"
|
||||
|
@ -214,6 +343,15 @@ dependencies = [
|
|||
"vec_map",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cmake"
|
||||
version = "0.1.50"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a31c789563b815f77f4250caee12365734369f942439b7defd71e18a48197130"
|
||||
dependencies = [
|
||||
"cc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "combine"
|
||||
version = "4.6.6"
|
||||
|
@ -224,6 +362,26 @@ dependencies = [
|
|||
"memchr",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "const_format"
|
||||
version = "0.2.31"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c990efc7a285731f9a4378d81aff2f0e85a2c8781a05ef0f8baa8dac54d0ff48"
|
||||
dependencies = [
|
||||
"const_format_proc_macros",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "const_format_proc_macros"
|
||||
version = "0.2.31"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e026b6ce194a874cb9cf32cd5772d1ef9767cc8fcb5765948d74f37a9d8b2bf6"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"unicode-xid",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "convert_case"
|
||||
version = "0.4.0"
|
||||
|
@ -259,7 +417,7 @@ version = "0.2.12"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f034b2258e6c4ade2f73bf87b21047567fb913ee9550837c2316d139b0262b24"
|
||||
dependencies = [
|
||||
"bindgen",
|
||||
"bindgen 0.64.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -284,7 +442,16 @@ dependencies = [
|
|||
"wasm-bindgen",
|
||||
"wasm-bindgen-futures",
|
||||
"web-sys",
|
||||
"windows",
|
||||
"windows 0.46.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cvt"
|
||||
version = "0.1.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d2ae9bf77fbf2d39ef573205d554d87e86c12f1994e9ea335b0651b9b278bcf1"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -306,12 +473,140 @@ dependencies = [
|
|||
"syn 1.0.109",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "either"
|
||||
version = "1.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07"
|
||||
|
||||
[[package]]
|
||||
name = "embuild"
|
||||
version = "0.31.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "781ccceeeb5ec01843b78b12b39cab4c90d6dbf853e1e8c2536cdb16e9da642a"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"bindgen 0.63.0",
|
||||
"bitflags 1.3.2",
|
||||
"cmake",
|
||||
"filetime",
|
||||
"globwalk",
|
||||
"home",
|
||||
"log",
|
||||
"remove_dir_all",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"shlex",
|
||||
"strum",
|
||||
"tempfile",
|
||||
"thiserror",
|
||||
"which",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "envy"
|
||||
version = "0.4.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3f47e0157f2cb54f5ae1bd371b30a2ae4311e1c028f575cd4e81de7353215965"
|
||||
dependencies = [
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "equivalent"
|
||||
version = "1.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5"
|
||||
|
||||
[[package]]
|
||||
name = "errno"
|
||||
version = "0.3.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "136526188508e25c6fef639d7927dfb3e0e3084488bf202267829cf7fc23dbdd"
|
||||
dependencies = [
|
||||
"errno-dragonfly",
|
||||
"libc",
|
||||
"windows-sys 0.48.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "errno-dragonfly"
|
||||
version = "0.1.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf"
|
||||
dependencies = [
|
||||
"cc",
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "esp-idf-sys"
|
||||
version = "0.33.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0e0982cea5ec42cccbd9fc57698499489b503c525efaacc0368a363371694c9b"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"bindgen 0.63.0",
|
||||
"build-time",
|
||||
"cargo_metadata",
|
||||
"const_format",
|
||||
"embuild",
|
||||
"envy",
|
||||
"libc",
|
||||
"regex",
|
||||
"serde",
|
||||
"strum",
|
||||
"which",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "esp-pbuf"
|
||||
version = "0.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7e4e265745059669e3767ab11a5d2e4c4d20d0bbdad74d8ac054cbcc92bb0c8b"
|
||||
dependencies = [
|
||||
"embuild",
|
||||
"esp-idf-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "fastrand"
|
||||
version = "2.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6999dc1837253364c2ebb0704ba97994bd874e8f195d665c50b7548f6ea92764"
|
||||
|
||||
[[package]]
|
||||
name = "filetime"
|
||||
version = "0.2.22"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d4029edd3e734da6fe05b6cd7bd2960760a616bd2ddd0d59a0124746d6272af0"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"libc",
|
||||
"redox_syscall",
|
||||
"windows-sys 0.48.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "fnv"
|
||||
version = "1.0.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
|
||||
|
||||
[[package]]
|
||||
name = "fs_at"
|
||||
version = "0.1.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "982f82cc75107eef84f417ad6c53ae89bf65b561937ca4a3b3b0fd04d0aa2425"
|
||||
dependencies = [
|
||||
"aligned",
|
||||
"cfg-if",
|
||||
"cvt",
|
||||
"libc",
|
||||
"nix 0.26.2",
|
||||
"windows-sys 0.48.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "getrandom"
|
||||
version = "0.2.10"
|
||||
|
@ -329,6 +624,30 @@ version = "0.3.1"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b"
|
||||
|
||||
[[package]]
|
||||
name = "globset"
|
||||
version = "0.4.13"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "759c97c1e17c55525b57192c06a267cda0ac5210b222d6b82189a2338fa1c13d"
|
||||
dependencies = [
|
||||
"aho-corasick",
|
||||
"bstr",
|
||||
"fnv",
|
||||
"log",
|
||||
"regex",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "globwalk"
|
||||
version = "0.8.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "93e3af942408868f6934a7b85134a3230832b9977cf66125df2f9edcfce4ddcc"
|
||||
dependencies = [
|
||||
"bitflags 1.3.2",
|
||||
"ignore",
|
||||
"walkdir",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hashbrown"
|
||||
version = "0.14.0"
|
||||
|
@ -344,6 +663,12 @@ dependencies = [
|
|||
"unicode-segmentation",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "heck"
|
||||
version = "0.4.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8"
|
||||
|
||||
[[package]]
|
||||
name = "hermit-abi"
|
||||
version = "0.1.19"
|
||||
|
@ -353,6 +678,55 @@ dependencies = [
|
|||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "home"
|
||||
version = "0.5.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5444c27eef6923071f7ebcc33e3444508466a76f7a2b93da00ed6e19f30c1ddb"
|
||||
dependencies = [
|
||||
"windows-sys 0.48.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "iana-time-zone"
|
||||
version = "0.1.57"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2fad5b825842d2b38bd206f3e81d6957625fd7f0a361e345c30e01a0ae2dd613"
|
||||
dependencies = [
|
||||
"android_system_properties",
|
||||
"core-foundation-sys 0.8.4",
|
||||
"iana-time-zone-haiku",
|
||||
"js-sys",
|
||||
"wasm-bindgen",
|
||||
"windows 0.48.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "iana-time-zone-haiku"
|
||||
version = "0.1.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f"
|
||||
dependencies = [
|
||||
"cc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ignore"
|
||||
version = "0.4.20"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dbe7873dab538a9a44ad79ede1faf5f30d49f9a5c883ddbab48bce81b64b7492"
|
||||
dependencies = [
|
||||
"globset",
|
||||
"lazy_static",
|
||||
"log",
|
||||
"memchr",
|
||||
"regex",
|
||||
"same-file",
|
||||
"thread_local",
|
||||
"walkdir",
|
||||
"winapi-util",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "indexmap"
|
||||
version = "2.0.0"
|
||||
|
@ -449,6 +823,12 @@ dependencies = [
|
|||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "linux-raw-sys"
|
||||
version = "0.4.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1a9bad9f94746442c783ca431b22403b519cd7fbeed0533fdd6328b2f2212128"
|
||||
|
||||
[[package]]
|
||||
name = "lock_api"
|
||||
version = "0.4.10"
|
||||
|
@ -558,6 +938,15 @@ dependencies = [
|
|||
"minimal-lexical",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "normpath"
|
||||
version = "1.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ec60c60a693226186f5d6edf073232bfb6464ed97eb22cf3b01c1e8198fd97f5"
|
||||
dependencies = [
|
||||
"windows-sys 0.48.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num-derive"
|
||||
version = "0.3.3"
|
||||
|
@ -795,6 +1184,22 @@ version = "0.7.4"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e5ea92a5b6195c6ef2a0295ea818b312502c6fc94dde986c5553242e18fd4ce2"
|
||||
|
||||
[[package]]
|
||||
name = "remove_dir_all"
|
||||
version = "0.8.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "23895cfadc1917fed9c6ed76a8c2903615fa3704f7493ff82b364c6540acc02b"
|
||||
dependencies = [
|
||||
"aligned",
|
||||
"cfg-if",
|
||||
"cvt",
|
||||
"fs_at",
|
||||
"lazy_static",
|
||||
"libc",
|
||||
"normpath",
|
||||
"windows-sys 0.45.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rustc-hash"
|
||||
version = "1.1.0"
|
||||
|
@ -810,6 +1215,25 @@ dependencies = [
|
|||
"semver",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rustix"
|
||||
version = "0.38.13"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d7db8590df6dfcd144d22afd1b83b36c21a18d7cbc1dc4bb5295a8712e9eb662"
|
||||
dependencies = [
|
||||
"bitflags 2.4.0",
|
||||
"errno",
|
||||
"libc",
|
||||
"linux-raw-sys",
|
||||
"windows-sys 0.48.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rustversion"
|
||||
version = "1.0.14"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4"
|
||||
|
||||
[[package]]
|
||||
name = "ryu"
|
||||
version = "1.0.15"
|
||||
|
@ -836,6 +1260,9 @@ name = "semver"
|
|||
version = "1.0.18"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b0293b4b29daaf487284529cc2f5675b8e57c61f70167ba415a463651fd6a918"
|
||||
dependencies = [
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde"
|
||||
|
@ -896,9 +1323,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "2538b18701741680e0322a2302176d3253a35388e2e62f172f64f4f16605f877"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"windows-sys",
|
||||
"windows-sys 0.48.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "stable_deref_trait"
|
||||
version = "1.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3"
|
||||
|
||||
[[package]]
|
||||
name = "static_assertions"
|
||||
version = "1.1.0"
|
||||
|
@ -928,13 +1361,35 @@ version = "0.4.18"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dcb5ae327f9cc13b68763b5749770cb9e048a99bd9dfdfa58d0cf05d5f64afe0"
|
||||
dependencies = [
|
||||
"heck",
|
||||
"heck 0.3.3",
|
||||
"proc-macro-error",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 1.0.109",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "strum"
|
||||
version = "0.24.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "063e6045c0e62079840579a7e47a355ae92f60eb74daaf156fb1e84ba164e63f"
|
||||
dependencies = [
|
||||
"strum_macros",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "strum_macros"
|
||||
version = "0.24.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1e385be0d24f186b4ce2f9982191e7101bb737312ad61c1f2f984f34bcf85d59"
|
||||
dependencies = [
|
||||
"heck 0.4.1",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"rustversion",
|
||||
"syn 1.0.109",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "1.0.109"
|
||||
|
@ -957,6 +1412,19 @@ dependencies = [
|
|||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tempfile"
|
||||
version = "3.8.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cb94d2f3cc536af71caac6b6fcebf65860b347e7ce0cc9ebe8f70d3e521054ef"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"fastrand",
|
||||
"redox_syscall",
|
||||
"rustix",
|
||||
"windows-sys 0.48.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "termcolor"
|
||||
version = "1.2.0"
|
||||
|
@ -995,6 +1463,16 @@ dependencies = [
|
|||
"syn 2.0.28",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "thread_local"
|
||||
version = "1.1.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3fdd6f064ccff2d6567adcb3873ca630700f00b5ad3f060c25b5dcfd9a4ce152"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"once_cell",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "toml"
|
||||
version = "0.7.6"
|
||||
|
@ -1047,6 +1525,12 @@ version = "0.1.10"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b"
|
||||
|
||||
[[package]]
|
||||
name = "unicode-xid"
|
||||
version = "0.2.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c"
|
||||
|
||||
[[package]]
|
||||
name = "vec_map"
|
||||
version = "0.8.2"
|
||||
|
@ -1151,6 +1635,18 @@ dependencies = [
|
|||
"wasm-bindgen",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "which"
|
||||
version = "4.4.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "87ba24419a2078cd2b0f2ede2691b6c66d8e47836da3b6db8265ebad47afbfc7"
|
||||
dependencies = [
|
||||
"either",
|
||||
"home",
|
||||
"once_cell",
|
||||
"rustix",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "winapi"
|
||||
version = "0.3.9"
|
||||
|
@ -1191,6 +1687,24 @@ dependencies = [
|
|||
"windows-targets 0.42.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows"
|
||||
version = "0.48.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e686886bc078bc1b0b600cac0147aadb815089b6e4da64016cbd754b6342700f"
|
||||
dependencies = [
|
||||
"windows-targets 0.48.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-sys"
|
||||
version = "0.45.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0"
|
||||
dependencies = [
|
||||
"windows-targets 0.42.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-sys"
|
||||
version = "0.48.0"
|
||||
|
|
|
@ -4,11 +4,12 @@ version = "0.1.0"
|
|||
edition = "2021"
|
||||
|
||||
[features]
|
||||
default = ["alloc"]
|
||||
alloc = ["bytemuck/extern_crate_alloc"]
|
||||
pbuf = []
|
||||
default = []
|
||||
|
||||
[dependencies]
|
||||
bitflags = { workspace = true }
|
||||
bytemuck = { workspace = true }
|
||||
derive_more = { workspace = true }
|
||||
|
||||
[target.'cfg(target_os="espidf")'.dependencies]
|
||||
esp-pbuf = "0.1"
|
||||
|
|
|
@ -1,23 +1,21 @@
|
|||
use core::fmt::{self, Debug};
|
||||
|
||||
#[cfg(feature = "alloc")]
|
||||
#[path = "buffer/alloc_impl.rs"]
|
||||
pub mod alloc;
|
||||
#[cfg(feature = "alloc")]
|
||||
use alloc as impl_;
|
||||
|
||||
#[cfg(feature = "pbuf")]
|
||||
#[cfg(target_os = "espidf")]
|
||||
#[path = "buffer/pbuf_impl.rs"]
|
||||
pub mod pbuf;
|
||||
#[cfg(feature = "pbuf")]
|
||||
#[cfg(target_os = "espidf")]
|
||||
use pbuf as impl_;
|
||||
|
||||
#[cfg(not(target_os = "espidf"))]
|
||||
#[path = "buffer/alloc_impl.rs"]
|
||||
pub mod alloc;
|
||||
#[cfg(not(target_os = "espidf"))]
|
||||
use alloc as impl_;
|
||||
|
||||
pub use impl_::{RawBuffer, BufferImpl};
|
||||
|
||||
#[derive(Debug, Copy, Clone)]
|
||||
pub struct AllocError {
|
||||
pub requested_bytes: usize,
|
||||
}
|
||||
pub struct AllocError(pub impl_::AllocError);
|
||||
|
||||
#[repr(transparent)]
|
||||
pub struct PacketBuffer {
|
||||
|
@ -33,12 +31,13 @@ impl Debug for PacketBuffer {
|
|||
impl PacketBuffer {
|
||||
pub fn allocate(len: usize) -> Result<Self, AllocError> {
|
||||
Ok(PacketBuffer {
|
||||
underlying: BufferImpl::allocate_zeroed(len)?,
|
||||
underlying: BufferImpl::allocate_zeroed(len)
|
||||
.map_err(AllocError)?,
|
||||
})
|
||||
}
|
||||
|
||||
pub fn from_underlying(underlying: BufferImpl) -> Self {
|
||||
PacketBuffer { underlying }
|
||||
pub fn from_raw(raw: RawBuffer) -> Self {
|
||||
PacketBuffer { underlying: BufferImpl::from_raw(raw) }
|
||||
}
|
||||
|
||||
pub fn underlying(&self) -> &BufferImpl {
|
||||
|
|
|
@ -1,15 +1,14 @@
|
|||
extern crate alloc;
|
||||
use alloc::vec::Vec;
|
||||
use crate::buffer::AllocError;
|
||||
|
||||
pub type RawBuffer = Vec<u8>;
|
||||
pub type RawBuffer = alloc::vec::Vec<u8>;
|
||||
pub type AllocError = core::convert::Infallible;
|
||||
|
||||
#[repr(transparent)]
|
||||
pub struct BufferImpl(RawBuffer);
|
||||
|
||||
impl BufferImpl {
|
||||
pub fn allocate_zeroed(len: usize) -> Result<Self, AllocError> {
|
||||
let mut vec = Vec::with_capacity(len);
|
||||
let mut vec = RawBuffer::with_capacity(len);
|
||||
vec.resize(len, 0);
|
||||
Ok(BufferImpl(vec))
|
||||
}
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
use core::ptr::NonNull;
|
||||
pub use esp_pbuf::{Pbuf, PbufMut, AllocatePbufError};
|
||||
use esp_pbuf::PbufUninit;
|
||||
|
||||
use crate::buffer::AllocError;
|
||||
|
||||
pub type RawBuffer = NonNull<ffi::pbuf>;
|
||||
pub type RawBuffer = esp_pbuf::PbufMut;
|
||||
pub type AllocError = AllocatePbufError;
|
||||
|
||||
#[repr(transparent)]
|
||||
pub struct BufferImpl(RawBuffer);
|
||||
|
@ -11,70 +11,33 @@ unsafe impl Send for BufferImpl {}
|
|||
unsafe impl Sync for BufferImpl {}
|
||||
|
||||
impl BufferImpl {
|
||||
pub fn allocate_zeroed(len: usize) -> Result<Self, AllocError> {
|
||||
let mut pbuf = alloc_uninit_pbuf(len)
|
||||
.ok_or(AllocError { requested_bytes: len })?;
|
||||
|
||||
// SAFETY: pbuf payload ptr always points to buffer of size len
|
||||
unsafe {
|
||||
let payload = pbuf.as_mut().payload as *mut u8;
|
||||
core::ptr::write_bytes(payload, 0, len);
|
||||
}
|
||||
|
||||
Ok(BufferImpl(pbuf))
|
||||
pub fn allocate_zeroed(len: usize) -> Result<Self, AllocatePbufError> {
|
||||
let pbuf = PbufUninit::allocate(ffi::PBUF_TRANSPORT, len, ffi::PBUF_RAM)?;
|
||||
Ok(BufferImpl(pbuf.zeroed()))
|
||||
}
|
||||
|
||||
pub unsafe fn from_raw(pbuf: RawBuffer) -> Self {
|
||||
pub fn from_raw(pbuf: RawBuffer) -> Self {
|
||||
BufferImpl(pbuf)
|
||||
}
|
||||
|
||||
pub fn len(&self) -> usize {
|
||||
usize::from(self.pbuf().len)
|
||||
self.pbuf().len()
|
||||
}
|
||||
|
||||
pub fn bytes(&self) -> &[u8] {
|
||||
let len = self.len();
|
||||
let payload = self.pbuf().payload as *const _;
|
||||
|
||||
// SAFETY: pbuf payload ptr always points to buffer of size len
|
||||
unsafe { core::slice::from_raw_parts(payload, len) }
|
||||
self.pbuf().bytes()
|
||||
}
|
||||
|
||||
pub fn bytes_mut(&mut self) -> &mut [u8] {
|
||||
let len = self.len();
|
||||
let payload = self.pbuf_mut().payload;
|
||||
|
||||
// SAFETY: pbuf payload ptr always points to a buffer of size len
|
||||
unsafe { core::slice::from_raw_parts_mut(payload, len) }
|
||||
self.pbuf_mut().bytes_mut()
|
||||
}
|
||||
|
||||
pub fn pbuf(&self) -> &ffi::pbuf {
|
||||
// SAFETY: this struct owns ffi::pbuf
|
||||
unsafe { self.0.as_ref() }
|
||||
pub fn pbuf(&self) -> &Pbuf {
|
||||
&self.0
|
||||
}
|
||||
|
||||
pub fn pbuf_mut(&mut self) -> &mut ffi::pbuf {
|
||||
// SAFETY: this struct owns ffi::pbuf
|
||||
unsafe { self.0.as_mut() }
|
||||
}
|
||||
}
|
||||
|
||||
fn alloc_uninit_pbuf(len: usize) -> Option<NonNull<ffi::pbuf>> {
|
||||
let len = u16::try_from(len).ok()?;
|
||||
|
||||
// SAFETY: calls an alloc function, always safe
|
||||
let ptr = unsafe {
|
||||
ffi::pbuf_alloc(ffi::PBUF_TRANSPORT as i32, len, ffi::PBUF_RAM)
|
||||
};
|
||||
|
||||
NonNull::new(ptr)
|
||||
}
|
||||
|
||||
|
||||
impl Drop for BufferImpl {
|
||||
fn drop(&mut self) {
|
||||
// SAFETY: we own pbuf
|
||||
unsafe { ffi::pbuf_free(self.0.as_ptr()); }
|
||||
pub fn pbuf_mut(&mut self) -> &mut Pbuf {
|
||||
&mut self.0
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -87,24 +50,9 @@ pub mod ffi {
|
|||
|
||||
/// Downstream crates should statically assert that this is equal to or
|
||||
/// larger than their PBUF_TRANSPORT constant
|
||||
pub const PBUF_TRANSPORT: usize = 74;
|
||||
pub const PBUF_TRANSPORT: u32 = 74;
|
||||
|
||||
/// Downstream crates should statically assert that this is equal to their
|
||||
/// PBUF_RAM constant
|
||||
pub const PBUF_RAM: u32 = PBUF_ALLOC_FLAG_DATA_CONTIGUOUS | PBUF_TYPE_FLAG_STRUCT_DATA_CONTIGUOUS | PBUF_TYPE_ALLOC_SRC_MASK_STD_HEAP;
|
||||
|
||||
|
||||
#[repr(C)]
|
||||
pub struct pbuf {
|
||||
pub next: *mut pbuf,
|
||||
pub payload: *mut u8,
|
||||
pub tot_len: u16,
|
||||
pub len: u16,
|
||||
// fields continue but this is all we need
|
||||
}
|
||||
|
||||
extern "C" {
|
||||
pub fn pbuf_alloc(layer: i32, length: u16, type_: u32) -> *mut pbuf;
|
||||
pub fn pbuf_free(p: *mut pbuf) -> u8;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ edition = "2021"
|
|||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
bark-protocol = { workspace = true, features = ["alloc"] }
|
||||
bark-protocol = { workspace = true }
|
||||
|
||||
bitflags = { workspace = true }
|
||||
bytemuck = { workspace = true, features = ["extern_crate_alloc"] }
|
||||
|
|
|
@ -7,7 +7,6 @@ use nix::poll::{PollFd, PollFlags};
|
|||
use socket2::{Domain, Type};
|
||||
use structopt::StructOpt;
|
||||
|
||||
use bark_protocol::buffer::alloc::BufferImpl;
|
||||
use bark_protocol::buffer::PacketBuffer;
|
||||
use bark_protocol::packet::Packet;
|
||||
|
||||
|
@ -146,7 +145,7 @@ impl ProtocolSocket {
|
|||
assert!(nbytes < buffer.len());
|
||||
buffer.resize(nbytes, 0);
|
||||
|
||||
let buffer = PacketBuffer::from_underlying(BufferImpl::from_raw(buffer));
|
||||
let buffer = PacketBuffer::from_raw(buffer);
|
||||
|
||||
Ok((buffer, peer))
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue