note: associated function defined here
--> /Users/christian/.cargo/registry/src/github.com-1ecc6299db9ec823/kira-0.5.3/src/manager/mod.rs:143:9
|
143 | pub fn new(settings: AudioManagerSettings) -> Result<Self, SetupError> {
| ^^^
error[E0277]: the ? operator can only be used in a function that returns Result or Option (or another type that implements FromResidual)
--> src/main.rs:16:23
8
/ fn abc() {
9
extern crate kira;
10
extern crate kira_cpal;
11
extern crate kira_loaders;
...
16
CpalBackend::new()?,
^ cannot use the ? operator in a function that returns ()
...
19
Result::<(), Box>::Ok(())
20
}
_- this function should return Result or Option to accept ?
= help: the trait FromResidual<Result<Infallible, DeviceSetupError>> is not implemented for ()
error[E0277]: the ? operator can only be used in a function that returns Result or Option (or another type that implements FromResidual)
--> src/main.rs:18:2
8
/ fn abc() {
9
extern crate kira;
10
extern crate kira_cpal;
11
extern crate kira_loaders;
...
18
)?;
^ cannot use the ? operator in a function that returns ()
19
Result::<(), Box>::Ok(())
20
}
_- this function should return Result or Option to accept ?
= help: the trait FromResidual<Result<Infallible, SetupError>> is not implemented for ()
Hi, I'm new to Rust and would need audio playback for my project. I can't compile your examples. Can you please help me? Thanks.
note: associated function defined here --> /Users/christian/.cargo/registry/src/github.com-1ecc6299db9ec823/kira-0.5.3/src/manager/mod.rs:143:9 | 143 | pub fn new(settings: AudioManagerSettings) -> Result<Self, SetupError> { | ^^^
?
operator can only be used in a function that returnsResult
orOption
(or another type that implementsFromResidual
) --> src/main.rs:16:23?
operator in a function that returns()
...Result
orOption
to accept?
= help: the trait
FromResidual<Result<Infallible, DeviceSetupError>>
is not implemented for()
?
operator can only be used in a function that returnsResult
orOption
(or another type that implementsFromResidual
) --> src/main.rs:18:2?
operator in a function that returns()
19Result
orOption
to accept?
= help: the trait
FromResidual<Result<Infallible, SetupError>>
is not implemented for()
()
, found enumResult
()
found enumResult<(), Box<dyn std::error::Error>>
help: consider using a semicolon here