mirror of
https://github.com/alexpasmantier/television.git
synced 2025-06-03 01:50:12 +00:00
perf(stdin): avoid unnecessary allocations when streaming from stdin (#475)
This commit is contained in:
parent
433d7fa270
commit
ce02824f3c
@ -77,10 +77,10 @@ fn stream_from_stdin(injector: &Injector<String>) {
|
||||
loop {
|
||||
match stdin.read_line(&mut buffer) {
|
||||
Ok(c) if c > 0 => {
|
||||
let buf = buffer.trim();
|
||||
if !buf.is_empty() {
|
||||
injector.push(buf.to_string(), |e, cols| {
|
||||
cols[0] = e.to_string().into();
|
||||
let trimmed = buffer.trim();
|
||||
if !trimmed.is_empty() {
|
||||
injector.push(trimmed.to_owned(), |e, cols| {
|
||||
cols[0] = e.clone().into();
|
||||
});
|
||||
}
|
||||
buffer.clear();
|
||||
|
Loading…
x
Reference in New Issue
Block a user