feat: add rich text extraction

- add video detail tests
This commit is contained in:
ThetaDev 2022-09-21 15:00:33 +02:00
parent 3596861b77
commit 8629454b5b
18 changed files with 1784 additions and 8921 deletions

View file

@ -1,3 +1,5 @@
use std::convert::TryInto;
use serde::{Deserialize, Serialize};
/// The paginator is a wrapper around a list of items that are fetched
@ -28,7 +30,7 @@ pub struct Paginator<T> {
impl<T> Default for Paginator<T> {
fn default() -> Self {
Self {
count: None,
count: Some(0),
items: Vec::new(),
ctoken: None,
}
@ -36,6 +38,17 @@ impl<T> Default for Paginator<T> {
}
impl<T> Paginator<T> {
pub(crate) fn new(count: Option<u32>, items: Vec<T>, ctoken: Option<String>) -> Self {
Self {
count: match ctoken {
Some(_) => count,
None => items.len().try_into().ok(),
},
items,
ctoken,
}
}
/// Check if the paginator is exhausted, meaning that no more
/// items can be fetched.
///