cargo fmt
This commit is contained in:
parent
1196bebb92
commit
61ec4e5fa7
22
src/main.rs
22
src/main.rs
|
@ -1,16 +1,14 @@
|
||||||
use tokio::select;
|
use serde::{self, Deserialize, Serialize};
|
||||||
use tokio::signal::unix::{SignalKind, signal};
|
|
||||||
use std::env;
|
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use serde::{self, Serialize, Deserialize};
|
use std::env;
|
||||||
|
use tokio::select;
|
||||||
|
use tokio::signal::unix::{signal, SignalKind};
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Debug)]
|
#[derive(Serialize, Deserialize, Debug)]
|
||||||
#[serde(tag = "msgtype")]
|
#[serde(tag = "msgtype")]
|
||||||
enum MessageContent {
|
enum MessageContent {
|
||||||
#[serde(rename = "m.text")]
|
#[serde(rename = "m.text")]
|
||||||
Text {
|
Text { body: String },
|
||||||
body: String,
|
|
||||||
},
|
|
||||||
|
|
||||||
#[serde(other)]
|
#[serde(other)]
|
||||||
Other,
|
Other,
|
||||||
|
@ -77,7 +75,10 @@ struct SyncCommand {
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn sync<S: AsRef<str>>(key: S) -> Result<(), Box<dyn std::error::Error>> {
|
async fn sync<S: AsRef<str>>(key: S) -> Result<(), Box<dyn std::error::Error>> {
|
||||||
let body = reqwest::get(&format!("https://matrix.org/_matrix/client/r0/sync?access_token={}&timeout=3000", key.as_ref()))
|
let body = reqwest::get(&format!(
|
||||||
|
"https://matrix.org/_matrix/client/r0/sync?access_token={}&timeout=3000",
|
||||||
|
key.as_ref()
|
||||||
|
))
|
||||||
.await?
|
.await?
|
||||||
.text()
|
.text()
|
||||||
.await?;
|
.await?;
|
||||||
|
@ -88,7 +89,10 @@ async fn sync<S: AsRef<str>>(key: S) -> Result<(), Box<dyn std::error::Error>> {
|
||||||
|
|
||||||
#[tokio::main]
|
#[tokio::main]
|
||||||
async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||||
let key = std::env::args().skip(1).next().expect("Need a key as an argument");
|
let key = std::env::args()
|
||||||
|
.skip(1)
|
||||||
|
.next()
|
||||||
|
.expect("Need a key as an argument");
|
||||||
let mut sigint = signal(SignalKind::interrupt())?;
|
let mut sigint = signal(SignalKind::interrupt())?;
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
|
|
Loading…
Reference in New Issue