Guest User

Untitled

a guest
Jan 26th, 2024
161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Rust 11.72 KB | None | 0 0
  1. error[E0107]: trait takes 0 lifetime arguments but 1 lifetime argument was supplied
  2.   --> src/bin/main.rs:66:45
  3.    |
  4. 66 | async fn measurments_task(sensor: SDC41<dyn I2c<'static, I2C1, Async>>) -> ! {
  5.   |                                             ^^^ ------- help: remove this lifetime argument
  6.   |                                             |
  7.   |                                             expected 0 lifetime arguments
  8.   |
  9. note: trait defined here, with 0 lifetime parameters
  10.  --> /home/holo/.cargo/registry/src/index.crates.io-6f17d22bba15001f/embedded-hal-async-1.0.0/src/i2c.rs:25:11
  11.   |
  12. 25 | pub trait I2c<A: AddressMode = SevenBitAddress>: ErrorType {
  13.   |           ^^^
  14.  
  15. error[E0107]: trait takes at most 1 generic argument but 2 generic arguments were supplied
  16.  --> src/bin/main.rs:66:45
  17.   |
  18. 66 | async fn measurments_task(sensor: SDC41<dyn I2c<'static, I2C1, Async>>) -> ! {
  19.    |                                             ^^^                ----- help: remove this generic argument
  20.    |                                             |
  21.    |                                             expected at most 1 generic argument
  22.    |
  23. note: trait defined here, with at most 1 generic parameter: `A`
  24.   --> /home/holo/.cargo/registry/src/index.crates.io-6f17d22bba15001f/embedded-hal-async-1.0.0/src/i2c.rs:25:11
  25.    |
  26. 25 | pub trait I2c<A: AddressMode = SevenBitAddress>: ErrorType {
  27.    |           ^^^ --------------------------------
  28.  
  29. error[E0191]: the value of the associated type `Error` in `embedded_hal::i2c::ErrorType` must be specified
  30.   --> src/bin/main.rs:66:45
  31.    |
  32. 66 | async fn measurments_task(sensor: SDC41<dyn I2c<'static, I2C1, Async>>) -> ! {
  33.   |                                             ^^^^^^^^^^^^^^^^^^^^^^^^^ help: specify the associated type: `I2c<'static, I2C1, Async, Error = Type>`
  34.  
  35. error[E0038]: the trait `embedded_hal_async::i2c::I2c` cannot be made into an object
  36.    --> src/bin/main.rs:66:35
  37.     |
  38. 66  | async fn measurments_task(sensor: SDC41<dyn I2c<'static, I2C1, Async>>) -> ! {
  39.    |                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `embedded_hal_async::i2c::I2c` cannot be made into an object
  40.    |
  41. note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
  42.   --> /home/holo/.cargo/registry/src/index.crates.io-6f17d22bba15001f/embedded-hal-async-1.0.0/src/i2c.rs:45:14
  43.    |
  44. 45  |     async fn read(&mut self, address: A, read: &mut [u8]) -> Result<(), Self::Error> {
  45.    |              ^^^^ the trait cannot be made into an object because method `read` is `async`
  46. ...
  47. 67  |     async fn write(&mut self, address: A, write: &[u8]) -> Result<(), Self::Error> {
  48.    |              ^^^^^ the trait cannot be made into an object because method `write` is `async`
  49. ...
  50. 95  |     async fn write_read(
  51.    |              ^^^^^^^^^^ the trait cannot be made into an object because method `write_read` is `async`
  52. ...
  53. 121 |     async fn transaction(
  54.    |              ^^^^^^^^^^^ the trait cannot be made into an object because method `transaction` is `async`
  55.    = help: the following types implement the trait, consider defining an enum where each variant holds one of these types, implementing `embedded_hal_async::i2c::I2c` for this new enum and using it instead:
  56.              &mut T
  57.              embassy_rp::i2c::I2c<'d, T, embassy_rp::i2c::Async>
  58.               embassy_embedded_hal::adapter::yielding_async::YieldingAsync<T>
  59.               embassy_embedded_hal::shared_bus::asynch::i2c::I2cDevice<'_, M, BUS>
  60.              embassy_embedded_hal::adapter::blocking_async::BlockingAsync<T>
  61.              embassy_embedded_hal::shared_bus::asynch::i2c::I2cDeviceWithConfig<'_, M, BUS>
  62. note: required by a bound in `SDC41`
  63.    --> /home/holo/workspace/embeded/scd41-embassy-rs/src/sdc41.rs:10:8
  64.     |
  65. 8   | pub struct SDC41<T>
  66.     |            ----- required by a bound in this struct
  67. 9   | where
  68. 10  |     T: I2c<SevenBitAddress>,
  69.     |        ^^^^^^^^^^^^^^^^^^^^ required by this bound in `SDC41`
  70.  
  71. error[E0038]: the trait `embedded_hal_async::i2c::I2c` cannot be made into an object
  72.    --> src/bin/main.rs:66:41
  73.     |
  74. 66  | async fn measurments_task(sensor: SDC41<dyn I2c<'static, I2C1, Async>>) -> ! {
  75.    |                                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `embedded_hal_async::i2c::I2c` cannot be made into an object
  76.    |
  77. note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
  78.   --> /home/holo/.cargo/registry/src/index.crates.io-6f17d22bba15001f/embedded-hal-async-1.0.0/src/i2c.rs:45:14
  79.    |
  80. 45  |     async fn read(&mut self, address: A, read: &mut [u8]) -> Result<(), Self::Error> {
  81.    |              ^^^^ the trait cannot be made into an object because method `read` is `async`
  82. ...
  83. 67  |     async fn write(&mut self, address: A, write: &[u8]) -> Result<(), Self::Error> {
  84.    |              ^^^^^ the trait cannot be made into an object because method `write` is `async`
  85. ...
  86. 95  |     async fn write_read(
  87.    |              ^^^^^^^^^^ the trait cannot be made into an object because method `write_read` is `async`
  88. ...
  89. 121 |     async fn transaction(
  90.    |              ^^^^^^^^^^^ the trait cannot be made into an object because method `transaction` is `async`
  91.    = help: the following types implement the trait, consider defining an enum where each variant holds one of these types, implementing `embedded_hal_async::i2c::I2c` for this new enum and using it instead:
  92.              &mut T
  93.              embassy_rp::i2c::I2c<'d, T, embassy_rp::i2c::Async>
  94.               embassy_embedded_hal::adapter::yielding_async::YieldingAsync<T>
  95.               embassy_embedded_hal::shared_bus::asynch::i2c::I2cDevice<'_, M, BUS>
  96.              embassy_embedded_hal::adapter::blocking_async::BlockingAsync<T>
  97.              embassy_embedded_hal::shared_bus::asynch::i2c::I2cDeviceWithConfig<'_, M, BUS>
  98.  
  99. error[E0277]: the size for values of type `(dyn embedded_hal_async::i2c::I2c + 'static)` cannot be known at compilation time
  100.  --> src/bin/main.rs:66:35
  101.   |
  102. 66 | async fn measurments_task(sensor: SDC41<dyn I2c<'static, I2C1, Async>>) -> ! {
  103.    |                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
  104.   |
  105.   = help: the trait `Sized` is not implemented for `(dyn embedded_hal_async::i2c::I2c + 'static)`
  106. note: required by a bound in `SDC41`
  107.   --> /home/holo/workspace/embeded/scd41-embassy-rs/src/sdc41.rs:8:18
  108.    |
  109. 8  | pub struct SDC41<T>
  110.    |                  ^ required by this bound in `SDC41`
  111.  
  112. error[E0609]: no field `measurments` on type `SDC41<dyn embedded_hal_async::i2c::I2c>`
  113.   --> src/bin/main.rs:67:12
  114.    |
  115. 67 |     sensor.measurments.await
  116.    |            ^^^^^^^^^^^ unknown field
  117.  
  118. error[E0038]: the trait `embedded_hal_async::i2c::I2c` cannot be made into an object
  119.    --> src/bin/main.rs:66:27
  120.     |
  121. 66  | async fn measurments_task(sensor: SDC41<dyn I2c<'static, I2C1, Async>>) -> ! {
  122.    |                           ^^^^^^ `embedded_hal_async::i2c::I2c` cannot be made into an object
  123.    |
  124. note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
  125.   --> /home/holo/.cargo/registry/src/index.crates.io-6f17d22bba15001f/embedded-hal-async-1.0.0/src/i2c.rs:45:14
  126.    |
  127. 45  |     async fn read(&mut self, address: A, read: &mut [u8]) -> Result<(), Self::Error> {
  128.    |              ^^^^ the trait cannot be made into an object because method `read` is `async`
  129. ...
  130. 67  |     async fn write(&mut self, address: A, write: &[u8]) -> Result<(), Self::Error> {
  131.    |              ^^^^^ the trait cannot be made into an object because method `write` is `async`
  132. ...
  133. 95  |     async fn write_read(
  134.    |              ^^^^^^^^^^ the trait cannot be made into an object because method `write_read` is `async`
  135. ...
  136. 121 |     async fn transaction(
  137.    |              ^^^^^^^^^^^ the trait cannot be made into an object because method `transaction` is `async`
  138.    = help: the following types implement the trait, consider defining an enum where each variant holds one of these types, implementing `embedded_hal_async::i2c::I2c` for this new enum and using it instead:
  139.              &mut T
  140.              embassy_rp::i2c::I2c<'d, T, embassy_rp::i2c::Async>
  141.               embassy_embedded_hal::adapter::yielding_async::YieldingAsync<T>
  142.               embassy_embedded_hal::shared_bus::asynch::i2c::I2cDevice<'_, M, BUS>
  143.              embassy_embedded_hal::adapter::blocking_async::BlockingAsync<T>
  144.              embassy_embedded_hal::shared_bus::asynch::i2c::I2cDeviceWithConfig<'_, M, BUS>
  145. note: required by a bound in `SDC41`
  146.    --> /home/holo/workspace/embeded/scd41-embassy-rs/src/sdc41.rs:10:8
  147.     |
  148. 8   | pub struct SDC41<T>
  149.     |            ----- required by a bound in this struct
  150. 9   | where
  151. 10  |     T: I2c<SevenBitAddress>,
  152.     |        ^^^^^^^^^^^^^^^^^^^^ required by this bound in `SDC41`
  153.  
  154. error[E0038]: the trait `embedded_hal_async::i2c::I2c` cannot be made into an object
  155.    --> src/bin/main.rs:66:27
  156.     |
  157. 66  | async fn measurments_task(sensor: SDC41<dyn I2c<'static, I2C1, Async>>) -> ! {
  158.    |                           ^^^^^^ `embedded_hal_async::i2c::I2c` cannot be made into an object
  159.    |
  160. note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
  161.   --> /home/holo/.cargo/registry/src/index.crates.io-6f17d22bba15001f/embedded-hal-async-1.0.0/src/i2c.rs:45:14
  162.    |
  163. 45  |     async fn read(&mut self, address: A, read: &mut [u8]) -> Result<(), Self::Error> {
  164.    |              ^^^^ the trait cannot be made into an object because method `read` is `async`
  165. ...
  166. 67  |     async fn write(&mut self, address: A, write: &[u8]) -> Result<(), Self::Error> {
  167.    |              ^^^^^ the trait cannot be made into an object because method `write` is `async`
  168. ...
  169. 95  |     async fn write_read(
  170.    |              ^^^^^^^^^^ the trait cannot be made into an object because method `write_read` is `async`
  171. ...
  172. 121 |     async fn transaction(
  173.    |              ^^^^^^^^^^^ the trait cannot be made into an object because method `transaction` is `async`
  174.    = help: the following types implement the trait, consider defining an enum where each variant holds one of these types, implementing `embedded_hal_async::i2c::I2c` for this new enum and using it instead:
  175.              &mut T
  176.              embassy_rp::i2c::I2c<'d, T, embassy_rp::i2c::Async>
  177.               embassy_embedded_hal::adapter::yielding_async::YieldingAsync<T>
  178.               embassy_embedded_hal::shared_bus::asynch::i2c::I2cDevice<'_, M, BUS>
  179.              embassy_embedded_hal::adapter::blocking_async::BlockingAsync<T>
  180.              embassy_embedded_hal::shared_bus::asynch::i2c::I2cDeviceWithConfig<'_, M, BUS>
  181.  
  182. error[E0277]: the size for values of type `(dyn embedded_hal_async::i2c::I2c + 'static)` cannot be known at compilation time
  183.  --> src/bin/main.rs:66:27
  184.   |
  185. 66 | async fn measurments_task(sensor: SDC41<dyn I2c<'static, I2C1, Async>>) -> ! {
  186.    |                           ^^^^^^ doesn't have a size known at compile-time
  187.   |
  188.   = help: the trait `Sized` is not implemented for `(dyn embedded_hal_async::i2c::I2c + 'static)`
  189. note: required by a bound in `SDC41`
  190.   --> /home/holo/workspace/embeded/scd41-embassy-rs/src/sdc41.rs:8:18
  191.    |
  192. 8  | pub struct SDC41<T>
  193.    |                  ^ required by this bound in `SDC41`
  194.  
Advertisement
Add Comment
Please, Sign In to add comment