trying to compile the wasm example...issue

Đang mở
#803 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
35/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
rust, wasm
Lĩnh vực
audio-video-rtc, backend

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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!

Ngôn ngữ chính
Rust
Star
4k
Fork
554
Merge trung bình
3 ngày 3 giờ
Pull request đã merge (30 ngày)
4

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của RustAudio/cpal

Tất cả issue của RustAudio/cpal

Issue tương tự

Thêm issue về Rust

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.