Attention needed from Mike Comfoltey and Owners Override
Erick Tryzelaar has uploaded the change for review![Open in Gerrit]()
Erick Tryzelaar would like Owners Override to review this change.
Commit message
[rust] Optimize reading lines from files
`std::io::BufRead::lines` allocates a `String` for each line, which is
not necessary in most cases. Instead, you can use a `String` buffer with
`std::io::BufRead::read_line`, but that API can be a little clunky,
especially if you use `continue` to skip a row early.
This patch creates a helper library `buf-read-ext`, which has a
`lending_lines` method. This applies the "lending iterator" pattern to
make sure the buffer is cleared on every `next()` call.
Finally, this pattern is applied to a few places in-tree that was using
`BufRead::lines`.
Change-Id: Ic7176d7629a2dc414264c537adc3070b8a45a00d
Change information
Files:
- M src/developer/ffx/tools/playground/BUILD.gn
- M src/developer/ffx/tools/playground/src/lib.rs
- M src/lib/BUILD.gn
- A src/lib/buf-read-ext/BUILD.gn
- A src/lib/buf-read-ext/OWNERS
- A src/lib/buf-read-ext/src/lib.rs
- M src/lib/diagnostics/selectors/BUILD.gn
- M src/lib/diagnostics/selectors/src/selectors.rs
- M src/security/lib/scrutiny/utils/BUILD.gn
- M src/security/lib/scrutiny/utils/src/golden.rs
- M src/sys/pkg/lib/fuchsia-pkg/BUILD.gn
- M src/sys/pkg/lib/fuchsia-pkg/src/meta_contents.rs
- M src/sys/pkg/lib/fuchsia-pkg/src/package_build_manifest.rs
- M src/sys/pkg/lib/package-tool/BUILD.gn
- M src/sys/pkg/lib/package-tool/src/package_archive.rs
- M src/sys/pkg/lib/system-image/BUILD.gn
- M src/sys/pkg/lib/system-image/src/path_hash_mapping.rs
Change size: M
Delta: 17 files changed, 153 insertions(+), 37 deletions(-)
Open in GerritRelated details
Attention is currently required from:
- Mike Comfoltey
- Owners Override
Gerrit-MessageType: newchange
Gerrit-Project: fuchsia
Gerrit-Branch: main
Gerrit-Change-Id: Ic7176d7629a2dc414264c537adc3070b8a45a00d
Gerrit-Change-Number: 1572233
Gerrit-PatchSet: 8
You received this message because you are subscribed to the Google Groups "owners-override" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
.