Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    matrixbot
    @matrixbot
    xionbox Any idea why that would happen?
    matrixbot
    @matrixbot
    xionbox Regardless, I now have another problem whereby I cannot seem to return some streaming data
    xionbox error[E0277]: the trait bound `std::result::Result<(), std::sync::mpsc::SendError<std::result::Result<xb::ephem_registry::State, _>>>: std::future::Future` is not satisfied --> src/traj_srv/srv.rs:470:37 | 470 | ... tx.send(Ok(xb_state.clone())).await.unwrap(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::future::Future` is not implemented for `std::result::Result<(), std::sync::mpsc::SendError<std::result::Result<xb::ephem_registry::State, _>>>`
    xionbox The exact line is tx.send(Ok(xb_state)).await.unwrap(); where xb_state is a struct also generated from prost
    xionbox Any idea what the problem could be?
    xionbox I created the channel with let (mut tx, rx) = mpsc::channel();
    matrixbot
    @matrixbot
    xionbox And the function returns a Result<Response<TrajStatesStream>, Status> where type TrajStatesStream = mpsc::Receiver<Result<XbState, Status>>;
    xionbox And XbState is generated from prost
    Lucio Franco
    @LucioFranco
    you can just drop the await
    matrixbot
    @matrixbot
    xionbox Oh yeah that worked, thanks!
    matrixbot
    @matrixbot
    xionbox Right, actually, another problem I had is that I saw mpsc in the example and assumed it was from std::sync but in fact it's from tokio::sync
    xionbox Works now
    matrixbot
    @matrixbot
    xionbox Any idea how I can solve the following problem:
    `` error[E0599]: no method namednextfound for typestd::pin::Pin<&mut tonic::codec::decode::Streaming<thalassa_pb::TrajState>>in the current scope --> src/traj_srv/srv.rs:500:45 | 500 | while let Some(traj_state) = stream.next().await { | ^^^^ method not found instd::pin::Pin<&mut tonic::codec::decode::Streaming<thalassa_pb::TrajState>>| = help: items from traits can only be used if the trait is in scope help: the following trait is implemented but not in scope; perhaps add ause` for it:
    |
    11 | use futures_util::stream::StreamExt;
    |
    xionbox I am using use futures_util::stream::StreamExt;
    xionbox In fact it's on the line right below what rustc recommends ...
    matrixbot
    @matrixbot
    dominic_ Hi I made this PR but i can not fint why the test is failing. tokio-rs/tokio#2079
    dominic_ Because of bad formatting but I ran cargo fmt everywhere
    Carl Lerche
    @carllerche
    cargo fmt is buggy
    matrixbot
    @matrixbot
    dominic_ So how can I fix it ?
    Carl Lerche
    @carllerche
    run that command
    matrixbot
    @matrixbot
    dominic_ ok
    dominic_ posted an image: image.png
    matrixbot
    @matrixbot
    dominic_ is this because copy.rs needs a new line at EOF ?
    dominic_ * is it because copy.rs needs a new line at EOF ?
    Carl Lerche
    @carllerche
    maybe
    i have not looked
    running the command will fix i think
    rustfmt --edition 2018 $(find . -name '*.rs' -print)
    matrixbot
    @matrixbot
    dominic_ ok that fixed it I guess
    dominic_ ci will tell me
    matrixbot
    @matrixbot
    dominic_ thx Carl Lerche (Gitter)
    dominic_ ci passed it now