[text] Inline the trivial Text publish_state forwarding overloads

This commit is contained in:
J. Nick Koston
2026-08-22 01:19:17 -05:00
parent ef1d77885d
commit 0de003b74f
2 changed files with 2 additions and 6 deletions
-4
View File
@@ -8,10 +8,6 @@ namespace esphome::text {
static const char *const TAG = "text"; static const char *const TAG = "text";
void Text::publish_state(const std::string &state) { this->publish_state(state.data(), state.size()); }
void Text::publish_state(const char *state) { this->publish_state(state, strlen(state)); }
void Text::publish_state(const char *state, size_t len) { void Text::publish_state(const char *state, size_t len) {
this->set_has_state(true); this->set_has_state(true);
// Only assign if changed to avoid heap allocation // Only assign if changed to avoid heap allocation
+2 -2
View File
@@ -23,8 +23,8 @@ class Text : public EntityBase {
std::string state; std::string state;
TextTraits traits; TextTraits traits;
void publish_state(const std::string &state); void publish_state(const std::string &state) { this->publish_state(state.data(), state.size()); }
void publish_state(const char *state); void publish_state(const char *state) { this->publish_state(state, strlen(state)); }
void publish_state(const char *state, size_t len); void publish_state(const char *state, size_t len);
/// Instantiate a TextCall object to modify this text component's state. /// Instantiate a TextCall object to modify this text component's state.