pub enum AssetEncoding {
Identity,
Brotli,
Zstd,
Gzip,
Deflate,
}Expand description
The encoding of an asset.
Variants§
Identity
The asset is not encoded.
Brotli
The asset is encoded with the Brotli algorithm.
Zstd
The asset is encoded with the Zstd algorithm.
Gzip
The asset is encoded with the Gzip algorithm.
Deflate
The asset is encoded with the Deflate algorithm.
Implementations§
Source§impl AssetEncoding
impl AssetEncoding
Sourcepub fn default_config(self) -> (AssetEncoding, String)
pub fn default_config(self) -> (AssetEncoding, String)
Returns the default encoding and file extension for the encoding.
The default encoding is the encoding that is used when the client
does not specify an encoding in the Accept-Encoding header.
The default encoding and file extension are:
§Examples
use ic_asset_certification::AssetEncoding;
let (encoding, extension) = AssetEncoding::Brotli.default_config();
assert_eq!(encoding, AssetEncoding::Brotli);
assert_eq!(extension, ".br");
let (encoding, extension) = AssetEncoding::Zstd.default_config();
assert_eq!(encoding, AssetEncoding::Zstd);
assert_eq!(extension, ".zst");
let (encoding, extension) = AssetEncoding::Gzip.default_config();
assert_eq!(encoding, AssetEncoding::Gzip);
assert_eq!(extension, ".gz");
let (encoding, extension) = AssetEncoding::Deflate.default_config();
assert_eq!(encoding, AssetEncoding::Deflate);
assert_eq!(extension, ".zz");
let (encoding, extension) = AssetEncoding::Identity.default_config();
assert_eq!(encoding, AssetEncoding::Identity);
assert_eq!(extension, "");Sourcepub fn custom_config(self, extension: String) -> (AssetEncoding, String)
pub fn custom_config(self, extension: String) -> (AssetEncoding, String)
Returns an encoding with a custom file extension. This is useful when the default file extension assigned by default_config is not desired.
§Examples
use ic_asset_certification::AssetEncoding;
let (encoding, extension) = AssetEncoding::Brotli.custom_config("brotli".to_string());
assert_eq!(encoding, AssetEncoding::Brotli);
assert_eq!(extension, "brotli");Trait Implementations§
Source§impl Clone for AssetEncoding
impl Clone for AssetEncoding
Source§fn clone(&self) -> AssetEncoding
fn clone(&self) -> AssetEncoding
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 moreSource§impl Debug for AssetEncoding
impl Debug for AssetEncoding
Source§impl Display for AssetEncoding
impl Display for AssetEncoding
Source§impl Hash for AssetEncoding
impl Hash for AssetEncoding
Source§impl PartialEq for AssetEncoding
impl PartialEq for AssetEncoding
impl Copy for AssetEncoding
impl Eq for AssetEncoding
impl StructuralPartialEq for AssetEncoding
Auto Trait Implementations§
impl Freeze for AssetEncoding
impl RefUnwindSafe for AssetEncoding
impl Send for AssetEncoding
impl Sync for AssetEncoding
impl Unpin for AssetEncoding
impl UnwindSafe for AssetEncoding
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