crosvm/base
Alexandre Courbot aa2e59d82f base: improve documentation of Descriptor and AsRawDescriptor
Although it can be useful for some limited cases, the Descriptor wrapper
class should ideally be eschewed and an alternative based on
implementing AsRawDescriptor on the right type be preferred. Make sure
its documentation reflects that.

The reason for avoiding Descriptor is that it encourages storing raw
descriptors that can possibly be closed before the user expects it. A
reasonable alternative to doing this is to call as_raw_descriptor() at
the exact moment the descriptor is needed, and never storing the result
- this ensures that the providing object (and underlying descriptor)
remain alive for long enough. Update the documentation of
AsRawDescriptor to explain and hopefully encourage this practice.

BUG=233968702
TEST=cargo build

Change-Id: I91c2ef11152b3b6adcc25f40d6de0a0f131700dd
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3670101
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
2022-05-28 07:29:03 +00:00
..
base_poll_token_derive Refactoring: Copy sys_util(_core) into base 2022-03-21 19:52:56 +00:00
src base: improve documentation of Descriptor and AsRawDescriptor 2022-05-28 07:29:03 +00:00
.build_test_serial Refactoring: Move common/base into base 2022-03-17 00:01:27 +00:00
Cargo.toml crosvm: rework logging 2022-05-23 21:11:49 +00:00