pub struct ReferenceYoutubeDownloadEnv { /* private fields */ }Expand description
Retrieves the representation one Youtube media request states.
Publication, progress, and reporting are the shared download interpreter’s; only locating the bytes is Youtube-specific, so only that is stated here.
Implementations§
Source§impl ReferenceYoutubeDownloadEnv
impl ReferenceYoutubeDownloadEnv
Sourcepub fn register_resource(
&mut self,
url: impl Into<String>,
bytes: impl Into<Vec<u8>>,
)
pub fn register_resource( &mut self, url: impl Into<String>, bytes: impl Into<Vec<u8>>, )
Associates exact bytes with one media URL.
Sourcepub fn opened(&self) -> Vec<YoutubeRequest>
pub fn opened(&self) -> Vec<YoutubeRequest>
Observes the requests retrieval opened, in retrieval order.
Sourcepub fn events(&self) -> Vec<DownloadEvent>
pub fn events(&self) -> Vec<DownloadEvent>
Observes terminal events in emission order.
Sourcepub fn progress(&self) -> Vec<DownloadProgress>
pub fn progress(&self) -> Vec<DownloadProgress>
Observes byte-progress reports in emission order.
Trait Implementations§
Source§impl AtomicPublishAlg for ReferenceYoutubeDownloadEnvwhere
ReferenceDownloadEnv: AtomicPublishAlg,
impl AtomicPublishAlg for ReferenceYoutubeDownloadEnvwhere
ReferenceDownloadEnv: AtomicPublishAlg,
Source§type Error = <ReferenceDownloadEnv as AtomicPublishAlg>::Error
type Error = <ReferenceDownloadEnv as AtomicPublishAlg>::Error
Source§type Publication = <ReferenceDownloadEnv as AtomicPublishAlg>::Publication
type Publication = <ReferenceDownloadEnv as AtomicPublishAlg>::Publication
Source§fn begin_publication(
&self,
destination: &Path,
) -> Result<Self::Publication, Self::Error>
fn begin_publication( &self, destination: &Path, ) -> Result<Self::Publication, Self::Error>
Source§fn write_publication(
&self,
publication: &mut Self::Publication,
bytes: &[u8],
) -> Result<(), Self::Error>
fn write_publication( &self, publication: &mut Self::Publication, bytes: &[u8], ) -> Result<(), Self::Error>
Source§fn commit_publication(
&self,
publication: Self::Publication,
) -> Result<(), Self::Error>
fn commit_publication( &self, publication: Self::Publication, ) -> Result<(), Self::Error>
Source§fn abort_publication(&self, publication: Self::Publication)
fn abort_publication(&self, publication: Self::Publication)
Source§impl Debug for ReferenceYoutubeDownloadEnv
impl Debug for ReferenceYoutubeDownloadEnv
Source§impl DownloadObservationAlg for ReferenceYoutubeDownloadEnv
impl DownloadObservationAlg for ReferenceYoutubeDownloadEnv
Source§type Event = <ReferenceDownloadEnv as DownloadObservationAlg>::Event
type Event = <ReferenceDownloadEnv as DownloadObservationAlg>::Event
Source§type Progress = <ReferenceDownloadEnv as DownloadObservationAlg>::Progress
type Progress = <ReferenceDownloadEnv as DownloadObservationAlg>::Progress
Source§fn download_progress(
&self,
destination: &Path,
downloaded: u64,
total: Option<u64>,
) -> Self::Progress
fn download_progress( &self, destination: &Path, downloaded: u64, total: Option<u64>, ) -> Self::Progress
Source§impl DownloadProgressAlg for ReferenceYoutubeDownloadEnv
impl DownloadProgressAlg for ReferenceYoutubeDownloadEnv
Source§type Progress = <ReferenceDownloadEnv as DownloadProgressAlg>::Progress
type Progress = <ReferenceDownloadEnv as DownloadProgressAlg>::Progress
Source§fn report_progress(&self, progress: Self::Progress)
fn report_progress(&self, progress: Self::Progress)
Source§impl DownloadReportAlg for ReferenceYoutubeDownloadEnv
impl DownloadReportAlg for ReferenceYoutubeDownloadEnv
Source§type Event = <ReferenceDownloadEnv as DownloadReportAlg>::Event
type Event = <ReferenceDownloadEnv as DownloadReportAlg>::Event
Source§fn report_download(&self, event: Self::Event)
fn report_download(&self, event: Self::Event)
Source§impl FetchStreamAlg<YoutubeRequest> for ReferenceYoutubeDownloadEnv
impl FetchStreamAlg<YoutubeRequest> for ReferenceYoutubeDownloadEnv
Source§type Error = ReferenceFetchError
type Error = ReferenceFetchError
Source§fn open_fetch(
&self,
request: &YoutubeRequest,
) -> Result<FetchStream<Self::Stream>, Self::Error>
fn open_fetch( &self, request: &YoutubeRequest, ) -> Result<FetchStream<Self::Stream>, Self::Error>
Auto Trait Implementations§
impl !Freeze for ReferenceYoutubeDownloadEnv
impl !RefUnwindSafe for ReferenceYoutubeDownloadEnv
impl !Sync for ReferenceYoutubeDownloadEnv
impl Send for ReferenceYoutubeDownloadEnv
impl Unpin for ReferenceYoutubeDownloadEnv
impl UnsafeUnpin for ReferenceYoutubeDownloadEnv
impl UnwindSafe for ReferenceYoutubeDownloadEnv
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<This, Source, FetchError, PublishError, Event, Progress> DownloadExt<This, Source, FetchError, PublishError, Event, Progress> for Thiswhere
This: FetchStreamAlg<Source, Error = FetchError> + AtomicPublishAlg<Error = PublishError> + DownloadObservationAlg<Event = Event, Progress = Progress> + DownloadProgressAlg<Progress = Progress> + DownloadReportAlg<Event = Event>,
FetchError: Display,
PublishError: Display,
Source: ?Sized,
impl<This, Source, FetchError, PublishError, Event, Progress> DownloadExt<This, Source, FetchError, PublishError, Event, Progress> for Thiswhere
This: FetchStreamAlg<Source, Error = FetchError> + AtomicPublishAlg<Error = PublishError> + DownloadObservationAlg<Event = Event, Progress = Progress> + DownloadProgressAlg<Progress = Progress> + DownloadReportAlg<Event = Event>,
FetchError: Display,
PublishError: Display,
Source: ?Sized,
Source§fn download_resource(
&self,
source: &Source,
destination: &Path,
) -> Result<u64, DownloadError<FetchError, PublishError>>
fn download_resource( &self, source: &Source, destination: &Path, ) -> Result<u64, DownloadError<FetchError, PublishError>>
Fetches, atomically publishes, and reports exactly one terminal event.
§Errors
Returns the fetch or publication failure after reporting it.
Source§impl<This> GaugeLaws<This> for This
impl<This> GaugeLaws<This> for This
Source§fn gauge_laws(&self) -> Result<(), Error>
fn gauge_laws(&self) -> Result<(), Error>
Checks that a gauge states a share without claiming more resolution than it has.
The laws checked are:
- a gauge occupies its stated width whatever share it states;
- no share is stated as filled before it is reached, and none is stated twice;
- nothing stated is nothing filled, and everything stated fills the whole track;
- the stated text occupies exactly one cell per counted cell.
§Errors
Returns the first violated law.
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 moreSource§impl<This> IntoExt<This> for This
impl<This> IntoExt<This> for This
Source§fn to<R>(self) -> Rwhere
This: Into<R>,
fn to<R>(self) -> Rwhere
This: Into<R>,
A version of Into::into function that can be used to explicitly specify the target
conversion type.
use alux_sdk::*;
// `Into` requires context to infer the type,
let _: i64 = Into::into(42_i8);
// The opposite `From` requires context to infer the type,
let _: i64 = From::from(42_i8);
// `.to()` can be used in the same way as a postfix function (the same as `.into()`),
let _: i64 = 42_i8.to();
// but also with the type specified explicitly.
let _ = 42_i8.to::<i64>();
// Especially useful to chain multiple conversions inline.
let _: i64 = 42_i8.to::<i16>().to::<i32>().into();Source§impl<This> IntoIteratorExt<This> for This
impl<This> IntoIteratorExt<This> for This
Source§fn try_collect_vec<T, E>(self) -> Result<Vec<T>, E>
fn try_collect_vec<T, E>(self) -> Result<Vec<T>, E>
A variant of the try_collect and collect_vec combined function from the Itertools
library. The materialized value is a Vec inside a Result object.
Returns the first error without collecting later values.
use alux_sdk::*;
let values = [Ok::<_, &str>(1), Ok(2), Ok(3)]
.into_iter()
.try_collect_vec();
assert_eq!(values, Ok(vec![1, 2, 3]));Source§fn collect_exact<T>(self, n: usize) -> Option<Vec<T>>where
This: Iterator<Item = T>,
fn collect_exact<T>(self, n: usize) -> Option<Vec<T>>where
This: Iterator<Item = T>,
Takes exactly n elements from the iterator.
Returns Some(Vec<T>) if the iterator yields exactly n elements,
otherwise returns None.
use alux_sdk::*;
let v = [1, 2, 3];
assert_eq!(v.iter().copied().collect_exact(3), Some(vec![1, 2, 3]));
assert_eq!(v.iter().copied().collect_exact(4), None);
assert_eq!(v.iter().copied().collect_exact(2), None);Source§fn try_unzip<A, B, E>(self) -> Result<(Vec<A>, Vec<B>), E>
fn try_unzip<A, B, E>(self) -> Result<(Vec<A>, Vec<B>), E>
Efficiently splits an iterator of Result<(A, B), E> into two Vecs, short-circuiting on error.
Consumes the iterator, collecting all A elements into one vector and all B elements into another,
without first allocating an intermediate vector of tuples. Returns the tuple (Vec<A>, Vec<B>) on success,
or the first error encountered.
use alux_sdk::*;
let input = vec![Ok((1, "x")), Ok((2, "y"))];
let (xs, ys) = input.try_unzip::<_, _, ()>().unwrap();
assert_eq!(xs, vec![1, 2]);
assert_eq!(ys, vec!["x", "y"]);