mirror of
https://github.com/esphome/esphome.git
synced 2026-09-24 05:24:14 +00:00
[text] Avoid string copies in callbacks by passing const ref (#12504)
This commit is contained in:
@@ -23,7 +23,7 @@ void Text::publish_state(const std::string &state) {
|
||||
#endif
|
||||
}
|
||||
|
||||
void Text::add_on_state_callback(std::function<void(std::string)> &&callback) {
|
||||
void Text::add_on_state_callback(std::function<void(const std::string &)> &&callback) {
|
||||
this->state_callback_.add(std::move(callback));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user