[core] Add cg.byte_span for std::span<const uint8_t> (#22462)

This commit is contained in:
J. Nick Koston authored and GitHub committed 2026-11-09 09:20:45 -05:00
1 parent d9cac9a88f
commit 3325b16c56
3 files changed
+6

No files matched your search

+1
View File
@@ -92,6 +92,7 @@ from esphome.cpp_types import ( # noqa: F401
StringRef,
arduino_json_ns,
bool_,
byte_span,
char,
const_char_ptr,
double,
+1
View File
@@ -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;
+4
View File
@@ -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"),
(