Struct pikadick::commands::tiktok_embed::TikTokData
source · pub struct TikTokData {
client: Client,
encoder_task: EncoderTask,
pub post_page_cache: TimedCache<String, Post>,
video_download_cache_path: Utf8PathBuf,
video_download_request_map: Arc<RequestMap<String, Result<Arc<Utf8Path>, ArcAnyhowError>>>,
video_encoder: &'static str,
}
Expand description
TikTok Data
Fields§
§client: Client
The inner client
encoder_task: EncoderTask
The encoder task
post_page_cache: TimedCache<String, Post>
A cache of post urls => post pages
video_download_cache_path: Utf8PathBuf
The path to tiktok’s cache dir
video_download_request_map: Arc<RequestMap<String, Result<Arc<Utf8Path>, ArcAnyhowError>>>
The request map for making requests for video downloads.
video_encoder: &'static str
Implementations§
source§impl TikTokData
impl TikTokData
sourcepub async fn new<P>(cache_dir: P, encoder_task: EncoderTask) -> Result<Self>where
P: AsRef<Utf8Path>,
pub async fn new<P>(cache_dir: P, encoder_task: EncoderTask) -> Result<Self>where P: AsRef<Utf8Path>,
Make a new TikTokData
.
sourcepub async fn get_post_cached(
&self,
url: &str
) -> Result<Arc<TimedCacheEntry<Post>>>
pub async fn get_post_cached( &self, url: &str ) -> Result<Arc<TimedCacheEntry<Post>>>
Get a post page, using the cache if needed
sourcepub async fn get_video_data_cached(
&self,
id: u64,
format: &str,
url: &str,
video_duration: u64
) -> Result<Arc<Utf8Path>>
pub async fn get_video_data_cached( &self, id: u64, format: &str, url: &str, video_duration: u64 ) -> Result<Arc<Utf8Path>>
Get video data, using the cache if needed
sourcepub async fn try_embed_url(
&self,
ctx: &Context,
msg: &Message,
url: &Url,
loading_reaction: &mut Option<LoadingReaction>,
delete_link: bool
) -> Result<()>
pub async fn try_embed_url( &self, ctx: &Context, msg: &Message, url: &Url, loading_reaction: &mut Option<LoadingReaction>, delete_link: bool ) -> Result<()>
Try embedding a url
Trait Implementations§
source§impl CacheStatsProvider for TikTokData
impl CacheStatsProvider for TikTokData
source§fn publish_cache_stats(&self, cache_stats_builder: &mut CacheStatsBuilder)
fn publish_cache_stats(&self, cache_stats_builder: &mut CacheStatsBuilder)
Publish stats to the provided
CacheStatsBuilder
.source§impl Clone for TikTokData
impl Clone for TikTokData
source§fn clone(&self) -> TikTokData
fn clone(&self) -> TikTokData
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for TikTokData
impl Send for TikTokData
impl Sync for TikTokData
impl Unpin for TikTokData
impl !UnwindSafe for TikTokData
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneDebuggableStorage for Twhere
T: DebuggableStorage + Clone,
impl<T> CloneDebuggableStorage for Twhere T: DebuggableStorage + Clone,
fn clone_storage(&self) -> Box<dyn CloneDebuggableStorage>
§impl<T> CloneableStorage for Twhere
T: Any + Send + Sync + Clone,
impl<T> CloneableStorage for Twhere T: Any + Send + Sync + Clone,
fn clone_storage(&self) -> Box<dyn CloneableStorage>
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T
in a tonic::Request