mirror of
https://github.com/alexpasmantier/television.git
synced 2025-06-06 03:25:23 +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 {
|
loop {
|
||||||
match stdin.read_line(&mut buffer) {
|
match stdin.read_line(&mut buffer) {
|
||||||
Ok(c) if c > 0 => {
|
Ok(c) if c > 0 => {
|
||||||
let buf = buffer.trim();
|
let trimmed = buffer.trim();
|
||||||
if !buf.is_empty() {
|
if !trimmed.is_empty() {
|
||||||
injector.push(buf.to_string(), |e, cols| {
|
injector.push(trimmed.to_owned(), |e, cols| {
|
||||||
cols[0] = e.to_string().into();
|
cols[0] = e.clone().into();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
buffer.clear();
|
buffer.clear();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user