pub struct MediaSyntax;Expand description
Reifies every media sort as inspectable Rust syntax.
One interpreter ties the whole knot: the sorts are shared, so the classes are only meaningful together and a single reification serves all of them.
Trait Implementations§
Source§impl ArtifactAlg for MediaSyntax
impl ArtifactAlg for MediaSyntax
Source§impl Clone for MediaSyntax
impl Clone for MediaSyntax
impl Copy for MediaSyntax
Source§impl Debug for MediaSyntax
impl Debug for MediaSyntax
Source§impl Default for MediaSyntax
impl Default for MediaSyntax
Source§impl ExtractionAlg for MediaSyntax
impl ExtractionAlg for MediaSyntax
Source§fn media(
&self,
id: impl Into<String>,
metadata: Self::Metadata,
formats: impl IntoIterator<Item = Self::Format>,
) -> Self::Extraction
fn media( &self, id: impl Into<String>, metadata: Self::Metadata, formats: impl IntoIterator<Item = Self::Format>, ) -> Self::Extraction
Source§fn url_reference(
&self,
url: impl Into<String>,
extractor: Option<Self::Extractor>,
transparent: bool,
) -> Self::Extraction
fn url_reference( &self, url: impl Into<String>, extractor: Option<Self::Extractor>, transparent: bool, ) -> Self::Extraction
Source§fn extraction_collection(
&self,
id: Option<String>,
kind: CollectionKind,
metadata: Self::Metadata,
entries: impl IntoIterator<Item = Self::Extraction>,
) -> Self::Extraction
fn extraction_collection( &self, id: Option<String>, kind: CollectionKind, metadata: Self::Metadata, entries: impl IntoIterator<Item = Self::Extraction>, ) -> Self::Extraction
Source§impl ExtractionViewAlg for MediaSyntax
impl ExtractionViewAlg for MediaSyntax
Source§impl FormatAlg for MediaSyntax
impl FormatAlg for MediaSyntax
Source§impl FormatPredicateAlg for MediaSyntax
impl FormatPredicateAlg for MediaSyntax
Source§fn any_format(&self) -> Self::Predicate
fn any_format(&self) -> Self::Predicate
Source§fn format_id(&self, id: impl Into<String>) -> Self::Predicate
fn format_id(&self, id: impl Into<String>) -> Self::Predicate
Source§fn observed_format(&self, key: impl Into<String>) -> Self::Predicate
fn observed_format(&self, key: impl Into<String>) -> Self::Predicate
Source§fn text_format(
&self,
key: impl Into<String>,
value: impl Into<String>,
) -> Self::Predicate
fn text_format( &self, key: impl Into<String>, value: impl Into<String>, ) -> Self::Predicate
Source§fn flag_format(&self, key: impl Into<String>, value: bool) -> Self::Predicate
fn flag_format(&self, key: impl Into<String>, value: bool) -> Self::Predicate
Source§fn number_format(
&self,
key: impl Into<String>,
comparison: FormatComparison,
value: f64,
) -> Self::Predicate
fn number_format( &self, key: impl Into<String>, comparison: FormatComparison, value: f64, ) -> Self::Predicate
Source§fn all_formats(
&self,
left: Self::Predicate,
right: Self::Predicate,
) -> Self::Predicate
fn all_formats( &self, left: Self::Predicate, right: Self::Predicate, ) -> Self::Predicate
Source§fn not_format(&self, predicate: Self::Predicate) -> Self::Predicate
fn not_format(&self, predicate: Self::Predicate) -> Self::Predicate
Source§impl FormatPredicateMatchAlg for MediaSyntax
impl FormatPredicateMatchAlg for MediaSyntax
Source§fn format_matches(&self, predicate: &FormatPredicate, format: &Format) -> bool
fn format_matches(&self, predicate: &FormatPredicate, format: &Format) -> bool
Source§impl FormatSelectionAlg for MediaSyntax
impl FormatSelectionAlg for MediaSyntax
Source§fn best_format(&self, predicate: Self::Predicate) -> Self::Selection
fn best_format(&self, predicate: Self::Predicate) -> Self::Selection
Source§fn worst_format(&self, predicate: Self::Predicate) -> Self::Selection
fn worst_format(&self, predicate: Self::Predicate) -> Self::Selection
Source§fn merge_formats(
&self,
selections: impl IntoIterator<Item = Self::Selection>,
) -> Self::Selection
fn merge_formats( &self, selections: impl IntoIterator<Item = Self::Selection>, ) -> Self::Selection
Source§fn fallback_formats(
&self,
selections: impl IntoIterator<Item = Self::Selection>,
) -> Self::Selection
fn fallback_formats( &self, selections: impl IntoIterator<Item = Self::Selection>, ) -> Self::Selection
Source§impl FormatSelectionApplyAlg for MediaSyntax
impl FormatSelectionApplyAlg for MediaSyntax
Source§fn select_formats<'a>(
&self,
formats: &'a [Format],
selection: &FormatSelection,
) -> Option<Vec<&'a Format>>
fn select_formats<'a>( &self, formats: &'a [Format], selection: &FormatSelection, ) -> Option<Vec<&'a Format>>
Source§impl FormatViewAlg for MediaSyntax
impl FormatViewAlg for MediaSyntax
Source§impl MediaSorts for MediaSyntax
impl MediaSorts for MediaSyntax
Source§type Metadata = InfoRecord
type Metadata = InfoRecord
Source§type Extraction = Extraction
type Extraction = Extraction
Source§type Extractor = ExtractorKey
type Extractor = ExtractorKey
Source§type Predicate = FormatPredicate
type Predicate = FormatPredicate
Source§type Selection = FormatSelection
type Selection = FormatSelection
Source§impl MediaViewAlg for MediaSyntax
impl MediaViewAlg for MediaSyntax
Source§impl MetadataAlg for MediaSyntax
impl MetadataAlg for MediaSyntax
Source§fn empty_metadata(&self) -> Self::Metadata
fn empty_metadata(&self) -> Self::Metadata
Source§fn null_metadata(&self) -> Self::Value
fn null_metadata(&self) -> Self::Value
Source§fn boolean_metadata(&self, value: bool) -> Self::Value
fn boolean_metadata(&self, value: bool) -> Self::Value
Source§fn integer_metadata(&self, value: i64) -> Self::Value
fn integer_metadata(&self, value: i64) -> Self::Value
Source§fn float_metadata(&self, value: f64) -> Self::Value
fn float_metadata(&self, value: f64) -> Self::Value
Source§fn list_metadata(
&self,
values: impl IntoIterator<Item = Self::Value>,
) -> Self::Value
fn list_metadata( &self, values: impl IntoIterator<Item = Self::Value>, ) -> Self::Value
Source§fn record_metadata(&self, record: Self::Metadata) -> Self::Value
fn record_metadata(&self, record: Self::Metadata) -> Self::Value
Source§impl MetadataViewAlg for MediaSyntax
impl MetadataViewAlg for MediaSyntax
Source§fn metadata_text<'a>(
&self,
metadata: &'a InfoRecord,
key: &str,
) -> Option<&'a str>
fn metadata_text<'a>( &self, metadata: &'a InfoRecord, key: &str, ) -> Option<&'a str>
Source§fn metadata_number(&self, metadata: &InfoRecord, key: &str) -> Option<i64>
fn metadata_number(&self, metadata: &InfoRecord, key: &str) -> Option<i64>
Source§impl OutputNameAlg for MediaSyntax
impl OutputNameAlg for MediaSyntax
Source§fn output_name(&self, component: String) -> Self::Output
fn output_name(&self, component: String) -> Self::Output
Auto Trait Implementations§
impl Freeze for MediaSyntax
impl RefUnwindSafe for MediaSyntax
impl Send for MediaSyntax
impl Sync for MediaSyntax
impl Unpin for MediaSyntax
impl UnsafeUnpin for MediaSyntax
impl UnwindSafe for MediaSyntax
Blanket Implementations§
Source§impl<This> ArtifactLaws<This> for Thiswhere
This: MetadataAlg + ArtifactAlg,
impl<This> ArtifactLaws<This> for Thiswhere
This: MetadataAlg + ArtifactAlg,
Source§fn artifact_laws(&self) -> Result<(), Error>
fn artifact_laws(&self) -> Result<(), Error>
Checks that an artifact is exactly its identity, its role, and its observations.
The laws checked are:
- definition is a function of identity, role, and observations;
- each of the three is significant, so changing one changes the artifact.
§Errors
Returns the first violated law.
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<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<This> FormatLaws<This> for This
impl<This> FormatLaws<This> for This
Source§fn format_laws(&self) -> Result<(), Error>
fn format_laws(&self) -> Result<(), Error>
Checks that a format states back exactly what it was defined with.
The laws checked are:
- an observation a format states is the one it is observed under;
- distinct observation names are independent;
- an unstated observation is absent rather than defaulted.
§Errors
Returns the first violated law.
Source§impl<This> FormatPredicateExt<This> for Thiswhere
This: FormatPredicateAlg,
impl<This> FormatPredicateExt<This> for Thiswhere
This: FormatPredicateAlg,
Source§fn has_audio(&self) -> <This as MediaSorts>::Predicate
fn has_audio(&self) -> <This as MediaSorts>::Predicate
Defines formats containing audio.
Source§fn has_video(&self) -> <This as MediaSorts>::Predicate
fn has_video(&self) -> <This as MediaSorts>::Predicate
Defines formats containing video.
Source§fn format_extension(
&self,
extension: impl Into<String>,
) -> <This as MediaSorts>::Predicate
fn format_extension( &self, extension: impl Into<String>, ) -> <This as MediaSorts>::Predicate
Defines formats stating one container or filename extension.
Source§fn at_most(
&self,
key: impl Into<String>,
value: f64,
) -> <This as MediaSorts>::Predicate
fn at_most( &self, key: impl Into<String>, value: f64, ) -> <This as MediaSorts>::Predicate
Defines formats whose observation is no greater than the stated number.
Source§fn at_least(
&self,
key: impl Into<String>,
value: f64,
) -> <This as MediaSorts>::Predicate
fn at_least( &self, key: impl Into<String>, value: f64, ) -> <This as MediaSorts>::Predicate
Defines formats whose observation is no smaller than the stated number.
Source§fn exactly(
&self,
key: impl Into<String>,
value: f64,
) -> <This as MediaSorts>::Predicate
fn exactly( &self, key: impl Into<String>, value: f64, ) -> <This as MediaSorts>::Predicate
Defines formats whose observation equals the stated number.
Source§fn less_than(
&self,
key: impl Into<String>,
value: f64,
) -> <This as MediaSorts>::Predicate
fn less_than( &self, key: impl Into<String>, value: f64, ) -> <This as MediaSorts>::Predicate
Defines formats whose observation is smaller than the stated number.
Source§fn greater_than(
&self,
key: impl Into<String>,
value: f64,
) -> <This as MediaSorts>::Predicate
fn greater_than( &self, key: impl Into<String>, value: f64, ) -> <This as MediaSorts>::Predicate
Defines formats whose observation is greater than the stated number.
Source§fn progressive_format(&self) -> <This as MediaSorts>::Predicate
fn progressive_format(&self) -> <This as MediaSorts>::Predicate
Defines formats containing both audio and video.
Source§fn audio_only_format(&self) -> <This as MediaSorts>::Predicate
fn audio_only_format(&self) -> <This as MediaSorts>::Predicate
Defines formats containing audio and no video.
Source§fn video_only_format(&self) -> <This as MediaSorts>::Predicate
fn video_only_format(&self) -> <This as MediaSorts>::Predicate
Defines formats containing video and no audio.
Source§impl<This, Predicate> FormatSelectionProgramExt<This, Predicate> for Thiswhere
This: FormatPredicateAlg<Predicate = Predicate, Predicate = Predicate> + FormatSelectionAlg,
impl<This, Predicate> FormatSelectionProgramExt<This, Predicate> for Thiswhere
This: FormatPredicateAlg<Predicate = Predicate, Predicate = Predicate> + FormatSelectionAlg,
Source§fn best_progressive_format(&self) -> <This as MediaSorts>::Selection
fn best_progressive_format(&self) -> <This as MediaSorts>::Selection
Defines the most preferred progressive format.
Source§fn preferred_progressive_format(
&self,
id: impl Into<String>,
) -> <This as MediaSorts>::Selection
fn preferred_progressive_format( &self, id: impl Into<String>, ) -> <This as MediaSorts>::Selection
Defines an exact format with a progressive fallback.
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"]);Source§impl<This> MediaOutputExt<This> for Thiswhere
This: MediaViewAlg + FormatViewAlg,
impl<This> MediaOutputExt<This> for Thiswhere
This: MediaViewAlg + FormatViewAlg,
Source§fn media_output_path(
&self,
media: &<This as MediaSorts>::Media,
format: &<This as MediaSorts>::Format,
target: &OutputTarget,
) -> PathBuf
fn media_output_path( &self, media: &<This as MediaSorts>::Media, format: &<This as MediaSorts>::Format, target: &OutputTarget, ) -> PathBuf
Defines the final path one media item publishes its selected format at.
Source§impl<This> MediaStreamsExt<This> for Thiswhere
This: FormatPredicateAlg,
impl<This> MediaStreamsExt<This> for Thiswhere
This: FormatPredicateAlg,
Source§fn stream_role_format(
&self,
streams: MediaStreams,
) -> <This as MediaSorts>::Predicate
fn stream_role_format( &self, streams: MediaStreams, ) -> <This as MediaSorts>::Predicate
Defines the predicate accepting exactly the formats those roles require.
Source§impl<This> MetadataExt<This> for Thiswhere
This: MetadataAlg,
impl<This> MetadataExt<This> for Thiswhere
This: MetadataAlg,
Source§fn text_metadata(
&self,
key: impl Into<String>,
value: impl Into<String>,
) -> <This as MediaSorts>::Metadata
fn text_metadata( &self, key: impl Into<String>, value: impl Into<String>, ) -> <This as MediaSorts>::Metadata
Defines a record containing one textual field.
Source§impl<This> ObservationLaws<This> for Thiswhere
This: MetadataAlg,
impl<This> ObservationLaws<This> for Thiswhere
This: MetadataAlg,
Source§impl<This> OutputNameExt<This> for Thiswhere
This: OutputNameAlg,
impl<This> OutputNameExt<This> for Thiswhere
This: OutputNameAlg,
Source§fn portable_output_name(
&self,
title: Option<&str>,
fallback: &str,
extension: Option<&str>,
) -> <This as MediaSorts>::Output
fn portable_output_name( &self, title: Option<&str>, fallback: &str, extension: Option<&str>, ) -> <This as MediaSorts>::Output
Defines a portable file name from title, identity, and extension.
Source§fn portable_user_output_name(
&self,
input: &str,
fallback_extension: Option<&str>,
) -> <This as MediaSorts>::Output
fn portable_user_output_name( &self, input: &str, fallback_extension: Option<&str>, ) -> <This as MediaSorts>::Output
Defines a portable edited file name.
Source§impl<This> OutputNameLaws<This> for Thiswhere
This: OutputNameAlg,
impl<This> OutputNameLaws<This> for Thiswhere
This: OutputNameAlg,
Source§impl<This> RequestSelectionExt<This> for Thiswhere
This: FormatPredicateAlg + FormatSelectionAlg,
impl<This> RequestSelectionExt<This> for Thiswhere
This: FormatPredicateAlg + FormatSelectionAlg,
Source§fn request_selection(
&self,
options: &impl RequestOptionsAlg,
) -> <This as MediaSorts>::Selection
fn request_selection( &self, options: &impl RequestOptionsAlg, ) -> <This as MediaSorts>::Selection
Defines the selection one request’s own choices state.
Source§impl<This> SelectionLaws<This> for Thiswhere
This: MetadataAlg + FormatAlg + FormatPredicateAlg + FormatSelectionAlg + FormatPredicateMatchAlg + FormatSelectionApplyAlg,
impl<This> SelectionLaws<This> for Thiswhere
This: MetadataAlg + FormatAlg + FormatPredicateAlg + FormatSelectionAlg + FormatPredicateMatchAlg + FormatSelectionApplyAlg,
Source§fn selection_laws(&self) -> Result<(), Error>
fn selection_laws(&self) -> Result<(), Error>
Checks best, worst, merge, and fallback against a catalog the scenario authors.
§Errors
Returns the first violated law.
Source§fn check_selection_against(
&self,
catalog: &[<This as MediaSorts>::Format],
predicate: &<This as MediaSorts>::Predicate,
) -> Result<(), Error>
fn check_selection_against( &self, catalog: &[<This as MediaSorts>::Format], predicate: &<This as MediaSorts>::Predicate, ) -> Result<(), Error>
Source§impl<This> YoutubeNotesExt<This> for Thiswhere
This: MetadataViewAlg,
impl<This> YoutubeNotesExt<This> for Thiswhere
This: MetadataViewAlg,
Source§fn granting_notes(
&self,
metadata: &<This as MediaSorts>::Metadata,
) -> Vec<String>
fn granting_notes( &self, metadata: &<This as MediaSorts>::Metadata, ) -> Vec<String>
States what extraction observed about granting, in the words a reader reads.
A player response describes formats this interpreter may or may not be able to read: some state no location, some are held behind an unanswered signature, and some are served slowly on purpose. What is said here is what was counted, and nothing is said about a count the extractor did not state.