feat: 利用 etag 节省内容传输,显式写明生命周期 (#464)

This commit is contained in:
ᴀᴍᴛᴏᴀᴇʀ
2025-09-24 02:03:06 +08:00
committed by GitHub
parent 210c94398a
commit bbbb7d0c5b
4 changed files with 48 additions and 31 deletions
@@ -184,7 +184,7 @@ impl<'a, W: AsyncWrite> AssWriter<'a, W> {
}
}
fn escape_text(text: &str) -> Cow<str> {
fn escape_text(text: &'_ str) -> Cow<'_, str> {
let text = text.trim();
if memchr::memchr(b'\n', text.as_bytes()).is_some() {
Cow::from(text.replace('\n', "\\N"))
+1 -1
View File
@@ -91,7 +91,7 @@ impl<'a> Video<'a> {
.collect())
}
pub async fn get_danmaku_writer(&self, page: &'a PageInfo) -> Result<DanmakuWriter> {
pub async fn get_danmaku_writer(&self, page: &'a PageInfo) -> Result<DanmakuWriter<'a>> {
let tasks = FuturesUnordered::new();
for i in 1..=page.duration.div_ceil(360) {
tasks.push(self.get_danmaku_segment(page, i as i64));