pub struct Variant { /* private fields */ }Expand description
Describes a transformable blob representation.
Implementations§
Source§impl Variant
impl Variant
Sourcepub fn new(blob: Blob, transformations: BTreeMap<String, Value>) -> Self
pub fn new(blob: Blob, transformations: BTreeMap<String, Value>) -> Self
Creates a new variant request.
Sourcepub fn content_type(&self) -> Option<&str>
pub fn content_type(&self) -> Option<&str>
Returns the output content type.
Sourcepub fn transformations(&self) -> &BTreeMap<String, Value>
pub fn transformations(&self) -> &BTreeMap<String, Value>
Returns the canonical transformations.
Sourcepub fn is_variable(&self) -> bool
pub fn is_variable(&self) -> bool
Returns whether the source blob can be transformed.
Sourcepub async fn is_processed<S: StorageService + ?Sized>(
&self,
service: &S,
) -> Result<bool, VariantError>
pub async fn is_processed<S: StorageService + ?Sized>( &self, service: &S, ) -> Result<bool, VariantError>
Returns whether the variant has already been processed.
§Errors
Returns an error when the storage backend existence check fails.
Sourcepub fn is_processed_sync<S: StorageService + ?Sized>(
&self,
service: &S,
) -> Result<bool, VariantError>
pub fn is_processed_sync<S: StorageService + ?Sized>( &self, service: &S, ) -> Result<bool, VariantError>
Returns whether the variant has already been processed using the thread-local runtime.
§Errors
Returns an error when the storage backend existence check fails.
Sourcepub async fn processed<S: StorageService + ?Sized>(
&self,
service: &S,
) -> Result<Self, VariantError>
pub async fn processed<S: StorageService + ?Sized>( &self, service: &S, ) -> Result<Self, VariantError>
Processes the variant and stores a cached placeholder object when missing.
§Errors
Returns an error when the blob cannot be transformed or the storage backend fails.
Sourcepub fn processed_sync<S: StorageService + ?Sized>(
&self,
service: &S,
) -> Result<Self, VariantError>
pub fn processed_sync<S: StorageService + ?Sized>( &self, service: &S, ) -> Result<Self, VariantError>
Processes the variant and stores a cached placeholder object when missing using the thread-local runtime.
§Errors
Returns an error when the blob cannot be transformed or the storage backend fails.
Sourcepub async fn url<S: StorageService + ?Sized>(
&self,
service: &S,
expires_in: Duration,
) -> Result<Url, VariantError>
pub async fn url<S: StorageService + ?Sized>( &self, service: &S, expires_in: Duration, ) -> Result<Url, VariantError>
Generates a storage-backed URL for the processed variant.
§Errors
Returns an error when the storage backend cannot generate the URL.
Sourcepub fn url_sync<S: StorageService + ?Sized>(
&self,
service: &S,
expires_in: Duration,
) -> Result<Url, VariantError>
pub fn url_sync<S: StorageService + ?Sized>( &self, service: &S, expires_in: Duration, ) -> Result<Url, VariantError>
Generates a storage-backed URL for the processed variant using the thread-local runtime.
§Errors
Returns an error when the storage backend cannot generate the URL.
Trait Implementations§
impl Eq for Variant
impl StructuralPartialEq for Variant
Auto Trait Implementations§
impl Freeze for Variant
impl RefUnwindSafe for Variant
impl Send for Variant
impl Sync for Variant
impl Unpin for Variant
impl UnsafeUnpin for Variant
impl UnwindSafe for Variant
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
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
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>
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>
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