pub struct PreviewService {
pub default_generator: Arc<UrlPreviewGenerator>,
pub twitter_generator: Arc<UrlPreviewGenerator>,
pub github_generator: Arc<UrlPreviewGenerator>,
/* private fields */
}
Expand description
PreviewService provides a unified preview generation service It can automatically identify different types of URLs and use appropriate processing strategies
Fields§
§default_generator: Arc<UrlPreviewGenerator>
§twitter_generator: Arc<UrlPreviewGenerator>
§github_generator: Arc<UrlPreviewGenerator>
Implementations§
Source§impl PreviewService
impl PreviewService
pub fn with_cache_cap(cache_capacity: usize) -> Self
pub fn with_no_cache() -> Self
pub fn new_with_config(config: PreviewServiceConfig) -> Self
pub async fn generate_preview(&self, url: &str) -> Result<Preview, PreviewError>
pub async fn generate_preview_no_cache( &self, url: &str, ) -> Result<Preview, PreviewError>
pub async fn generate_github_basic_preview( &self, url: &str, ) -> Result<Preview, PreviewError>
pub async fn get_github_detailed_info( &self, url: &str, ) -> Result<GitHubDetailedInfo, PreviewError>
Source§impl PreviewService
impl PreviewService
pub fn new_with_concurrency(config: PreviewServiceConfig) -> Self
pub async fn generate_preview_with_concurrency( &self, url: &str, ) -> Result<Preview, PreviewError>
Trait Implementations§
Source§impl Clone for PreviewService
impl Clone for PreviewService
Source§fn clone(&self) -> PreviewService
fn clone(&self) -> PreviewService
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 Freeze for PreviewService
impl !RefUnwindSafe for PreviewService
impl Send for PreviewService
impl Sync for PreviewService
impl Unpin for PreviewService
impl !UnwindSafe for PreviewService
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