mirror of
https://github.com/esphome/esphome.git
synced 2026-11-09 14:45:57 +00:00
[core] Add cg.byte_span for std::span<const uint8_t> (#22462)
This commit is contained in:
1 parent
d9cac9a88f
commit
3325b16c56
3 files changed
+6
No files matched your search
@@ -92,6 +92,7 @@ from esphome.cpp_types import ( # noqa: F401
|
||||
StringRef,
|
||||
arduino_json_ns,
|
||||
bool_,
|
||||
byte_span,
|
||||
char,
|
||||
const_char_ptr,
|
||||
double,
|
||||
|
||||
@@ -24,6 +24,7 @@ int16 = global_ns.namespace("int16_t")
|
||||
int32 = global_ns.namespace("int32_t")
|
||||
int64 = global_ns.namespace("int64_t")
|
||||
size_t = global_ns.namespace("size_t")
|
||||
byte_span = std_span.template(uint8.operator("const"))
|
||||
const_char_ptr = global_ns.namespace("const char *")
|
||||
NAN = global_ns.namespace("NAN")
|
||||
esphome_ns = global_ns # using namespace esphome;
|
||||
|
||||
@@ -77,6 +77,10 @@ def test_exists(attr):
|
||||
assert hasattr(cg, attr)
|
||||
|
||||
|
||||
def test_byte_span() -> None:
|
||||
assert str(cg.byte_span) == "std::span<const uint8_t>"
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
("type_str", "expected"),
|
||||
(
|
||||
|
||||
Reference in new issue
Block a user