Created
November 13, 2020 23:18
-
-
Save mcr/fecf6cd83104e395d56f2c38d5a30cc0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pub fn setup_writer(writer: tokio::net::UnixStream) -> impl Stream { | |
let my_write_stream = FramedWrite::new(writer, LengthDelimitedCodec::new()); | |
return tokio_serde::SymmetricallyFramed::new(my_write_stream, SymmetricalCbor::default()); | |
} | |
let mut serialized = setup_writer(pair.0); | |
... | |
to refactor from code that did: | |
let writer = pair.0; | |
let my_write_stream = FramedWrite::new(writer, LengthDelimitedCodec::new()); | |
let mut serialized = tokio_serde::SymmetricallyFramed::new(my_write_stream, SymmetricalCbor::default()); |
Author
mcr
commented
Nov 13, 2020
•
-*- mode: compilation; default-directory: "/ssw/projects/pandora/connect/connect/src/" -*-
Compilation started at Fri Nov 13 18:37:43
cargo test
Compiling connect v1.0.0 (/ssw/projects/pandora/connect/connect)
error[E0277]: the trait bound `bytes::Bytes: control::serde::Serialize` is not satisfied
--> src/control.rs:53:56
|
53 | pub fn setup_writer(writer: tokio::net::UnixStream) -> impl Sink<Bytes> {
| ^^^^^^^^^^^^^^^^ the trait `control::serde::Serialize` is not implemented for `bytes::Bytes`
...
56 | return tokio_serde::SymmetricallyFramed::new(my_write_stream, SymmetricalCbor::default());
| ---------------------------------------------------------------------------------- this returned value is of type `tokio_serde::Framed<tokio_util::codec::FramedWrite<dull::tokio::net::UnixStream, tokio_util::codec::LengthDelimitedCodec>, bytes::Bytes, bytes::Bytes, tokio_serde::formats::Cbor<bytes::Bytes, bytes::Bytes>>`
|
= note: required because of the requirements on the impl of `tokio_serde::Serializer<bytes::Bytes>` for `tokio_serde::formats::Cbor<bytes::Bytes, bytes::Bytes>`
= note: required because of the requirements on the impl of `futures::Sink<bytes::Bytes>` for `tokio_serde::Framed<tokio_util::codec::FramedWrite<dull::tokio::net::UnixStream, tokio_util::codec::LengthDelimitedCodec>, bytes::Bytes, bytes::Bytes, tokio_serde::formats::Cbor<bytes::Bytes, bytes::Bytes>>`
= note: the return type of a function must have a statically known size
error[E0308]: mismatched types
--> src/control.rs:90:21
|
90 | serialized.send(&data).await.unwrap();
| ^^^^^ expected struct `bytes::Bytes`, found `&&control::DullControl`
error[E0599]: no method named `unwrap` found for enum `std::result::Result<(), <impl futures::Sink<bytes::Bytes> as futures::Sink<bytes::Bytes>>::Error>` in the current scope
--> src/control.rs:90:34
|
90 | serialized.send(&data).await.unwrap();
| ^^^^^^ method not found in `std::result::Result<(), <impl futures::Sink<bytes::Bytes> as futures::Sink<bytes::Bytes>>::Error>`
|
= note: the method `unwrap` exists but the following trait bounds were not satisfied:
`<impl futures::Sink<bytes::Bytes> as futures::Sink<bytes::Bytes>>::Error: std::fmt::Debug`
error: aborting due to 3 previous errors
Some errors have detailed explanations: E0277, E0308, E0599.
For more information about an error, try `rustc --explain E0277`.
error: could not compile `connect`.
To learn more, run the command again with --verbose.
Compilation exited abnormally with code 101 at Fri Nov 13 18:37:45
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment