mirror of
https://github.com/esphome/esphome.git
synced 2026-02-18 15:35:59 -07:00
[text_sensor] Use StringRef for filter static data to avoid heap allocation
This commit is contained in:
@@ -62,7 +62,10 @@ optional<std::string> AppendFilter::new_value(std::string value) {
|
||||
}
|
||||
|
||||
// Prepend
|
||||
optional<std::string> PrependFilter::new_value(std::string value) { return this->prefix_ + value; }
|
||||
optional<std::string> PrependFilter::new_value(std::string value) {
|
||||
value.insert(0, this->prefix_.c_str(), this->prefix_.size());
|
||||
return value;
|
||||
}
|
||||
|
||||
// Substitute
|
||||
SubstituteFilter::SubstituteFilter(const std::initializer_list<Substitution> &substitutions)
|
||||
|
||||
Reference in New Issue
Block a user