pub struct Preview { /* private fields */ }Expand description
Preview artifact metadata.
Implementations§
Source§impl Preview
impl Preview
Sourcepub fn content_type(&self) -> &str
pub fn content_type(&self) -> &str
Returns the preview content type.
Sourcepub async fn is_processed<S: StorageService + ?Sized>(
&self,
service: &S,
) -> Result<bool, PreviewError>
pub async fn is_processed<S: StorageService + ?Sized>( &self, service: &S, ) -> Result<bool, PreviewError>
Returns whether the preview has been stored already.
§Errors
Returns an error when the storage existence check fails.
Sourcepub fn is_processed_sync<S: StorageService + ?Sized>(
&self,
service: &S,
) -> Result<bool, PreviewError>
pub fn is_processed_sync<S: StorageService + ?Sized>( &self, service: &S, ) -> Result<bool, PreviewError>
Returns whether the preview has been stored already using the thread-local runtime.
§Errors
Returns an error when the storage existence check fails.
Sourcepub async fn processed<S: StorageService + ?Sized>(
&self,
service: &S,
data: Bytes,
) -> Result<Self, PreviewError>
pub async fn processed<S: StorageService + ?Sized>( &self, service: &S, data: Bytes, ) -> Result<Self, PreviewError>
Sourcepub fn processed_sync<S: StorageService + ?Sized>(
&self,
service: &S,
data: Bytes,
) -> Result<Self, PreviewError>
pub fn processed_sync<S: StorageService + ?Sized>( &self, service: &S, data: Bytes, ) -> Result<Self, PreviewError>
Stores preview bytes when missing using the thread-local runtime.
§Errors
Returns an error when the storage upload fails.
Sourcepub async fn url<S: StorageService + ?Sized>(
&self,
service: &S,
expires_in: Duration,
) -> Result<Url, PreviewError>
pub async fn url<S: StorageService + ?Sized>( &self, service: &S, expires_in: Duration, ) -> Result<Url, PreviewError>
Sourcepub fn url_sync<S: StorageService + ?Sized>(
&self,
service: &S,
expires_in: Duration,
) -> Result<Url, PreviewError>
pub fn url_sync<S: StorageService + ?Sized>( &self, service: &S, expires_in: Duration, ) -> Result<Url, PreviewError>
Generates a preview URL using the thread-local runtime.
§Errors
Returns an error when the storage service cannot build a URL.
Trait Implementations§
impl Eq for Preview
impl StructuralPartialEq for Preview
Auto Trait Implementations§
impl Freeze for Preview
impl RefUnwindSafe for Preview
impl Send for Preview
impl Sync for Preview
impl Unpin for Preview
impl UnsafeUnpin for Preview
impl UnwindSafe for Preview
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more