You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
(Caveat: I'm new to Rust so I may have an incorrect understanding of traits or something. Please correct me if so.)
I'm trying to use this crate to implement a lsp client for my editor. I'm trying to things in some good way and am attempting to write a method that I will serialize stuff for me. It looks like:
use lsp_types::request::Request;
pub fn marshal<R: Request>(params: R::Params) -> Result<Vec<u8>> {
let mut s = Vec::new();
let msg = serde_json::to_writer(&mut s, ¶ms)?;
Ok(s)
}
The serde_json call complains because params doesn't implement the serde::ser::Serialize trait. I think this is true because it's not listed in the Request trait. However, all of the Params actually do implement that trait, so I think it can safely be added to the Request trait. Is this the case?
The text was updated successfully, but these errors were encountered:
I think this is ok, just being conservative/forgot about it. There was an equivalent issue for Deserialize#70 so it ought to be Serialize + DeserializeOwned
(Caveat: I'm new to Rust so I may have an incorrect understanding of traits or something. Please correct me if so.)
I'm trying to use this crate to implement a lsp client for my editor. I'm trying to things in some good way and am attempting to write a method that I will serialize stuff for me. It looks like:
The
serde_json
call complains because params doesn't implement theserde::ser::Serialize
trait. I think this is true because it's not listed in the Request trait. However, all of the Params actually do implement that trait, so I think it can safely be added to the Request trait. Is this the case?The text was updated successfully, but these errors were encountered: