forked from MightyPork/elefren-fork
Update tungstenite and toml libs
This commit is contained in:
File diff suppressed because one or more lines are too long
+4
-4
@@ -1,8 +1,8 @@
|
||||
use crate::data::AppData;
|
||||
use crate::Result;
|
||||
use std::io::{Read, Write, BufWriter};
|
||||
use std::path::Path;
|
||||
use std::fs::{File, OpenOptions};
|
||||
use std::io::{BufWriter, Read, Write};
|
||||
use std::path::Path;
|
||||
|
||||
/// Attempts to deserialize a Data struct from a string
|
||||
pub fn from_str(s: &str) -> Result<AppData> {
|
||||
@@ -11,7 +11,7 @@ pub fn from_str(s: &str) -> Result<AppData> {
|
||||
|
||||
/// Attempts to deserialize a Data struct from a slice of bytes
|
||||
pub fn from_slice(s: &[u8]) -> Result<AppData> {
|
||||
Ok(toml::from_slice(s)?)
|
||||
Ok(from_str(&String::from_utf8_lossy(s))?)
|
||||
}
|
||||
|
||||
/// Attempts to deserialize a Data struct from something that implements
|
||||
@@ -36,7 +36,7 @@ pub fn to_string(data: &AppData) -> Result<String> {
|
||||
|
||||
/// Attempts to serialize a Data struct to a Vec of bytes
|
||||
pub fn to_vec(data: &AppData) -> Result<Vec<u8>> {
|
||||
Ok(toml::to_vec(data)?)
|
||||
Ok(toml::to_string(data)?.as_bytes().to_vec())
|
||||
}
|
||||
|
||||
/// Attempts to serialize a Data struct to something that implements the
|
||||
|
||||
+4
-1
@@ -92,7 +92,7 @@ impl EventReader {
|
||||
|
||||
pub async fn send_ping(&mut self) -> std::result::Result<(), tokio_tungstenite::tungstenite::Error> {
|
||||
trace!("Sending ping");
|
||||
self.stream.send(Message::Ping("pleroma groups".as_bytes().to_vec())).await
|
||||
self.stream.send(Message::Ping("pleroma groups".as_bytes().into())).await
|
||||
}
|
||||
}
|
||||
|
||||
@@ -146,6 +146,9 @@ impl Stream for EventReader {
|
||||
Poll::Pending => {
|
||||
Poll::Pending
|
||||
}
|
||||
Poll::Ready(Some(Ok(Message::Frame(_)))) => {
|
||||
unreachable!();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user