VideoPlatform

Enum VideoPlatform 

Source
pub enum VideoPlatform {
    YouTube,
    Facebook,
    Vimeo,
    DailyMotion,
    Wistia,
}
Expand description

Supported video platforms

Variants§

§

YouTube

§

Facebook

§

Vimeo

§

DailyMotion

§

Wistia

Implementations§

Source§

impl VideoPlatform

Source

pub fn as_str(&self) -> &'static str

Get the platform name as a string

Examples found in repository?
examples/basic_usage.rs (line 25)
3fn main() {
4    let validator = VideoUrlValidator::new();
5
6    // Example URLs to test
7    let test_urls = [
8        "https://youtube.com/watch?v=dQw4w9WgXcQ",
9        "https://www.youtube.com/watch?v=abc123&t=30s",
10        "https://youtu.be/xyz789",
11        "https://vimeo.com/123456789",
12        "https://www.facebook.com/user/videos/987654321",
13        "https://dailymotion.com/video/x7abc123",
14        "https://dai.ly/x7def456",
15        "https://company.wistia.com/medias/abc123def456",
16        "https://invalid-url.com/video",
17    ];
18
19    println!("Video URL Validation Examples\n");
20    println!("{:-<60}", "");
21
22    for url in &test_urls {
23        match validator.validate_video_url(url) {
24            Some(platform) => {
25                println!("✅ {} -> {}", platform.as_str(), url);
26
27                // Show platform-specific validation
28                match platform {
29                    VideoPlatform::YouTube => {
30                        if let Some(id) = video_url_validator::extract_youtube_id(url) {
31                            println!("   Video ID: {}", id);
32                        }
33                    }
34                    VideoPlatform::Vimeo => {
35                        if let Some(id) = video_url_validator::extract_vimeo_id(url) {
36                            println!("   Video ID: {}", id);
37                        }
38                    }
39                    _ => {}
40                }
41            }
42            None => {
43                println!("❌ Invalid/Unsupported -> {}", url);
44            }
45        }
46        println!();
47    }
48
49    // Demonstrate batch validation
50    println!("\nBatch Validation Results:");
51    println!("{:-<60}", "");
52
53    let results = validator.validate_multiple(&test_urls);
54    let valid_count = results
55        .iter()
56        .filter(|(_, platform)| platform.is_some())
57        .count();
58
59    println!("Total URLs: {}", results.len());
60    println!("Valid URLs: {}", valid_count);
61    println!("Invalid URLs: {}", results.len() - valid_count);
62
63    // Show supported platforms
64    println!("\nSupported Platforms:");
65    println!("{:-<60}", "");
66    for platform in validator.supported_platforms() {
67        println!("• {}", platform.as_str());
68    }
69}

Trait Implementations§

Source§

impl Clone for VideoPlatform

Source§

fn clone(&self) -> VideoPlatform

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for VideoPlatform

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Hash for VideoPlatform

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for VideoPlatform

Source§

fn eq(&self, other: &VideoPlatform) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Eq for VideoPlatform

Source§

impl StructuralPartialEq for VideoPlatform

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.