Struct hls_m3u8::tags::ExtXKey [−][src]
pub struct ExtXKey<'a>(pub Option<DecryptionKey<'a>>);
Expand description
Specifies how to decrypt encrypted data from the server.
An unencrypted segment should be marked with ExtXKey::empty
.
Tuple Fields
0: Option<DecryptionKey<'a>>
Implementations
Constructs an ExtXKey
tag.
Example
use hls_m3u8::types::{DecryptionKey, EncryptionMethod, KeyFormat}; let key = ExtXKey::new( DecryptionKey::builder() .method(EncryptionMethod::Aes128) .uri("https://www.example.com/") .iv([ 16, 239, 143, 117, 140, 165, 85, 17, 85, 132, 187, 91, 60, 104, 127, 82, ]) .format(KeyFormat::Identity) .versions(vec![1, 2, 3, 4, 5]) .build()?, );
Returns true
if the key is not empty.
Example
use hls_m3u8::types::{DecryptionKey, EncryptionMethod}; let k = ExtXKey::new(DecryptionKey::new( EncryptionMethod::Aes128, "https://www.example.url", )); assert_eq!(k.is_some(), true); let k = ExtXKey::empty(); assert_eq!(k.is_some(), false);
Returns true
if the key is empty.
Example
use hls_m3u8::types::{DecryptionKey, EncryptionMethod}; let k = ExtXKey::new(DecryptionKey::new( EncryptionMethod::Aes128, "https://www.example.url", )); assert_eq!(k.is_none(), false); let k = ExtXKey::empty(); assert_eq!(k.is_none(), true);
Returns the underlying DecryptionKey
, if there is one.
Panics
Panics if there is no underlying decryption key.
Examples
use hls_m3u8::types::{DecryptionKey, EncryptionMethod}; let k = ExtXKey::new(DecryptionKey::new( EncryptionMethod::Aes128, "https://www.example.url", )); assert_eq!( k.unwrap(), DecryptionKey::new(EncryptionMethod::Aes128, "https://www.example.url") );
use hls_m3u8::types::DecryptionKey; let decryption_key: DecryptionKey = ExtXKey::empty().unwrap(); // panics
Returns a reference to the underlying DecryptionKey
.
Converts an ExtXKey
into an Option<DecryptionKey>
.
Example
use hls_m3u8::types::{DecryptionKey, EncryptionMethod}; assert_eq!(ExtXKey::empty().into_option(), None); assert_eq!( ExtXKey::new(DecryptionKey::new( EncryptionMethod::Aes128, "https://www.example.url" )) .into_option(), Some(DecryptionKey::new( EncryptionMethod::Aes128, "https://www.example.url" )) );
Trait Implementations
Performs the conversion.
Performs the conversion.
Performs the conversion.
This method returns an ordering between self
and other
values if one exists. Read more
This method tests less than (for self
and other
) and is used by the <
operator. Read more
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
Auto Trait Implementations
impl<'a> RefUnwindSafe for ExtXKey<'a>
impl<'a> UnwindSafe for ExtXKey<'a>
Blanket Implementations
Mutably borrows from an owned value. Read more