pub struct PreviewService {
pub default_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>Implementations§
Source§impl PreviewService
impl PreviewService
pub fn with_cache_cap(cache_capacity: usize) -> Self
pub fn 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_with_concurrency( &self, url: &str, ) -> Result<Preview, PreviewError>
Source§impl PreviewService
Static constructor methods
impl PreviewService
Static constructor methods
Sourcepub fn new_minimal() -> Self
pub fn new_minimal() -> Self
Create a new preview service for unit testing
pub async fn generate_preview_no_cache( &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 duplicate 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