diff options
author | Judy Hsiao <judyhsiao@chromium.org> | 2023-08-19 06:16:15 +0000 |
---|---|---|
committer | crosvm LUCI <crosvm-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2023-08-21 06:44:26 +0000 |
commit | 7fa57aefe784888d7055450ebbb212fd5e442025 (patch) | |
tree | ac59eeb32e98b578b788ddf362187fee3c5c8b7c /audio_streams_conformance_test | |
parent | 5b12ca8f0211ab288aa4100a45450b02cfeea1ff (diff) | |
download | crosvm-7fa57aefe784888d7055450ebbb212fd5e442025.tar.gz |
audio_streams_conformance_test: fix incorrect usage of `argh`
This CL correct the return type of from_str_fn passing to argh for
stream_source and format.
BUG=b:296446779
TEST=cargo build
Change-Id: I859202ea6de4b5a428f1b46d0de1102fcf16fc34
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4796168
Reviewed-by: Chih-Yang Hsia <paulhsia@chromium.org>
Commit-Queue: Judy Hsiao <judyhsiao@google.com>
Reviewed-by: George Burgess <gbiv@chromium.org>
Diffstat (limited to 'audio_streams_conformance_test')
-rw-r--r-- | audio_streams_conformance_test/src/args.rs | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/audio_streams_conformance_test/src/args.rs b/audio_streams_conformance_test/src/args.rs index f52e43c6f..b44bd384e 100644 --- a/audio_streams_conformance_test/src/args.rs +++ b/audio_streams_conformance_test/src/args.rs @@ -62,6 +62,14 @@ fn default_stream_source() -> StreamSourceEnum { StreamSourceEnum::NoopStream } +fn parse_stream_source(value: &str) -> Result<StreamSourceEnum, String> { + StreamSourceEnum::from_str(value).map_err(|e| e.to_string()) +} + +fn parse_format(value: &str) -> Result<SampleFormat, String> { + SampleFormat::from_str(value).map_err(|e| e.to_string()) +} + #[derive(Copy, Clone, Debug, FromArgs, Serialize)] /// audio_streams_conformance_test pub struct Args { @@ -70,7 +78,7 @@ pub struct Args { option, short = 'P', default = "default_stream_source()", - from_str_fn(StreamSourceEnum::from_str) + from_str_fn(parse_stream_source) )] pub stream_source: StreamSourceEnum, /// the channel numbers. (default: 2) @@ -81,7 +89,7 @@ pub struct Args { option, short = 'f', default = "default_sample_format()", - from_str_fn(SampleFormat::from_str) + from_str_fn(parse_format) )] pub format: SampleFormat, /// sample rate. (default: 48000) |