trying to compile the wasm example...issue

Abierto
#803 1 comentario 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
35/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Estancado
Stack tecnológico
rust, wasm

Línea de trabajo

Start with src/lib.rs in the wasm example, especially the code around lines 46–76 shown in the compiler output, and compare its build_output_stream call and sample type bounds with the CPAL 0.15 API. Check whether the reported errors still reproduce with npm run start; done means the example compiles and starts without those errors.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

platform - web

i am receiving the following errors when i try :: npm run start :: with the wasm example:


compiling hello_wasm v0.1.0 (C:\Users\Admin\Documents\ajhRust\Yew\ajhYewTree\hello_wasm)
error[E0277]: the trait bound T: SizedSample is not satisfied
--> src\lib.rs:61:10
|
61 | .build_output_stream(
| ^^^^^^^^^^^^^^^^^^^ the trait SizedSample is not implemented for T
|
note: required by a bound in build_output_stream
--> C:\Users\Admin.cargo\registry\src\index.crates.io-6f17d22bba15001f\cpal-0.15.2\src\traits.rs:161:12
|
153 | fn build_output_stream<T, D, E>(
| ------------------- required by a bound in this associated function
...
161 | T: SizedSample,
| ^^^^^^^^^^^ required by this bound in DeviceTrait::build_output_stream
help: consider further restricting this bound
|
46 | T: cpal::Sample + cpal::SizedSample,
| +++++++++++++++++++
error[E0061]: this method takes 4 arguments but 3 arguments were supplied
--> src\lib.rs:61:10
|
61 | .build_output_stream(
| __^^^^^^^^^^^^^^^^^^^-
62 | | config,
63 | | move |data: &mut [T], | write_data(data, channels, &mut next_value),
64 | | err_fn,
65 | | )
| |
- an argument of type Option<Duration> is missing
|
note: method defined here
--> C:\Users\Admin.cargo\registry\src\index.crates.io-6f17d22bba15001f\cpal-0.15.2\src\traits.rs:153:8
|
153 | fn build_output_stream<T, D, E>(
| ^^^^^^^^^^^^^^^^^^^
help: provide the argument
|
61 | .build_output_stream(config, move |data: &mut [T], _| write_data(data, channels, &mut next_value), err_fn, /* Option */)
|
error[E0038]: the trait Sample cannot be made into an object
--> src\lib.rs:76:24
|
76 | let value: T = cpal::Sample::from::(&next_sample());
| ^^^^^^^^^^^^ Sample cannot be made into an object
|
6f17d22bba15001f\dasp_sample-0.11.0\src\lib.rs:39:34
|
39 | pub trait Sample: Copy + Clone + PartialOrd + PartialEq {
| ^^^^^^^^^^ ^^^^^^^^^ the trait cannot be made into an object because it uses Self as a type parameter
| |
| the trait cannot be made into an object because it uses Self as a type parameter
error[E0782]: trait objects must include the dyn keyword
--> src\lib.rs:76:24
|
76 | let value: T = cpal::Sample::from::(&next_sample());
| ^^^^^^^^^^^^
|
help: add dyn keyword before this trait
|
76 | let value: T = ::from::(&next_sample());
| ++++ +


the first function requires another argument (a duration it seems) ,
and then there is an issue perhaps with context regarding Self...
...very interested in diving into your library but yes...thx!

Lenguaje dominante
Rust
Estrellas
4k
Forks
554
Merge medio
3 d 3 h
PR fusionados (30 d)
4

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de RustAudio/cpal

Todos los issues de RustAudio/cpal

Issues similares

Más issues de Rust

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.