chore: 使用 Arc 代替 Rc

This commit is contained in:
amtoaer
2024-03-23 00:09:31 +08:00
parent 1e16c40adc
commit 705877d497
3 changed files with 11 additions and 10 deletions

View File

@@ -1,4 +1,4 @@
use std::rc::Rc;
use std::sync::Arc;
use crate::Result;
@@ -44,7 +44,7 @@ pub struct FilterOption {
pub video_min_quality: VideoQuality,
pub audio_max_quality: AudioQuality,
pub audio_min_quality: AudioQuality,
pub codecs: Rc<Vec<VideoCodecs>>,
pub codecs: Arc<Vec<VideoCodecs>>,
pub no_dolby_video: bool,
pub no_dolby_audio: bool,
pub no_hdr: bool,

View File

@@ -1,4 +1,4 @@
use std::rc::Rc;
use std::sync::Arc;
use async_stream::stream;
use futures_core::stream::Stream;
@@ -7,15 +7,15 @@ use serde_json::Value;
use crate::bilibili::BiliClient;
use crate::Result;
pub struct FavoriteList {
client: Rc<BiliClient>,
client: Arc<BiliClient>,
fid: String,
}
#[allow(dead_code)]
#[derive(Debug, serde::Deserialize)]
pub struct FavoriteListInfo {
id: u64,
title: String,
pub id: u64,
pub title: String,
}
#[derive(Debug, serde::Deserialize)]
@@ -29,6 +29,7 @@ pub struct VideoInfo {
pub upper: Upper,
pub ctime: u64,
pub fav_time: u64,
pub pubtime: u64,
}
#[derive(Debug, serde::Deserialize)]
@@ -37,7 +38,7 @@ pub struct Upper {
pub name: String,
}
impl FavoriteList {
pub fn new(client: Rc<BiliClient>, fid: String) -> Self {
pub fn new(client: Arc<BiliClient>, fid: String) -> Self {
Self { client, fid }
}

View File

@@ -1,4 +1,4 @@
use std::rc::Rc;
use std::sync::Arc;
use reqwest::Method;
@@ -17,7 +17,7 @@ static DATA: &[char] = &[
];
pub struct Video {
client: Rc<BiliClient>,
client: Arc<BiliClient>,
pub aid: String,
pub bvid: String,
}
@@ -39,7 +39,7 @@ pub struct Page {
}
impl Video {
pub fn new(client: Rc<BiliClient>, bvid: String) -> Self {
pub fn new(client: Arc<BiliClient>, bvid: String) -> Self {
let aid = bvid_to_aid(&bvid).to_string();
Self { client, aid, bvid }
}