Cargo fmt
This commit is contained in:
parent
1916ea0efe
commit
00a5192d02
12
src/lib.rs
12
src/lib.rs
|
@ -1,9 +1,9 @@
|
|||
use regex::Regex;
|
||||
use reqwest::{Error as ReqwestError, StatusCode};
|
||||
use rss::{Channel, Error as RssError};
|
||||
use regex::Regex;
|
||||
use std::io::Cursor;
|
||||
|
||||
use worker::{Request, Env, Response, Router, event, Headers};
|
||||
use worker::{event, Env, Headers, Request, Response, Router};
|
||||
|
||||
#[derive(Debug)]
|
||||
enum CustomError {
|
||||
|
@ -24,7 +24,7 @@ impl From<RssError> for CustomError {
|
|||
}
|
||||
|
||||
#[event(fetch)]
|
||||
pub async fn main(req: Request, env: Env, _ctx: worker::Context) -> worker::Result<Response>{
|
||||
pub async fn main(req: Request, env: Env, _ctx: worker::Context) -> worker::Result<Response> {
|
||||
let router = Router::new();
|
||||
router
|
||||
.get_async("/", |_, ctx| async move {
|
||||
|
@ -38,7 +38,9 @@ pub async fn main(req: Request, env: Env, _ctx: worker::Context) -> worker::Resu
|
|||
headers.set("content-type", "application/rss+xml");
|
||||
|
||||
Ok(res.with_headers(headers))
|
||||
}).run(req, env).await
|
||||
})
|
||||
.run(req, env)
|
||||
.await
|
||||
}
|
||||
|
||||
async fn fetch_modified_rss() -> Result<String, CustomError> {
|
||||
|
@ -53,7 +55,7 @@ async fn fetch_modified_rss() -> Result<String, CustomError> {
|
|||
Err(RssError::InvalidStartTag) => {
|
||||
eprintln!("Invalid start tag found in the feed. Please check the feed URL or try again later.");
|
||||
return Ok(String::new());
|
||||
},
|
||||
}
|
||||
Err(err) => return Err(err.into()),
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue