Trait hls_m3u8::Decryptable[][src]

pub trait Decryptable<'a>: Sealed {
    fn keys(&self) -> Vec<&DecryptionKey<'a>>;

    fn first_key(&self) -> Option<&DecryptionKey<'a>> { ... }
fn len(&self) -> usize { ... }
fn is_empty(&self) -> bool { ... } }
Expand description

Signals that a type or some of the asssociated data might need to be decrypted.

Note

You are not supposed to implement this trait, therefore it is “sealed”.

Required methods

Returns all keys, associated with the type.

Example

use hls_m3u8::tags::ExtXMap;
use hls_m3u8::types::{ByteRange, EncryptionMethod};
use hls_m3u8::Decryptable;

let map = ExtXMap::with_range("https://www.example.url/", ByteRange::from(2..11));

for key in map.keys() {
    if key.method == EncryptionMethod::Aes128 {
        // fetch content with the uri and decrypt the result
        break;
    }
}

Provided methods

Most of the time only a single key is provided, so instead of iterating through all keys, one might as well just get the first key.

Returns the number of keys.

Returns true, if the number of keys is zero.

Implementors