pub struct TimecodeValidator { /* private fields */ }Expand description
Validates timecodes against a configurable set of rules.
§Example
use oximedia_timecode::{Timecode, FrameRate};
use oximedia_timecode::tc_validator::{TimecodeValidator, ValidatorConfig};
let validator = TimecodeValidator::new(ValidatorConfig::default());
let tc = Timecode::new(1, 0, 0, 0, FrameRate::Fps25).unwrap();
assert!(validator.validate(&tc).is_empty());Implementations§
Source§impl TimecodeValidator
impl TimecodeValidator
Sourcepub fn new(config: ValidatorConfig) -> Self
pub fn new(config: ValidatorConfig) -> Self
Create a new validator with the given configuration.
Sourcepub fn default_validator() -> Self
pub fn default_validator() -> Self
Create a validator with default rules.
Sourcepub fn validate(&self, tc: &Timecode) -> Vec<TcViolation>
pub fn validate(&self, tc: &Timecode) -> Vec<TcViolation>
Validate a Timecode and return all violations found.
An empty Vec means the timecode is valid under the configured rules.
Sourcepub fn validate_range(
&self,
timecodes: &[Timecode],
) -> Vec<(usize, TcViolation)>
pub fn validate_range( &self, timecodes: &[Timecode], ) -> Vec<(usize, TcViolation)>
Validate a range of consecutive timecodes for continuity. Returns violations for any timecode in the slice that fails validation.
Trait Implementations§
Source§impl Clone for TimecodeValidator
impl Clone for TimecodeValidator
Source§fn clone(&self) -> TimecodeValidator
fn clone(&self) -> TimecodeValidator
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for TimecodeValidator
impl RefUnwindSafe for TimecodeValidator
impl Send for TimecodeValidator
impl Sync for TimecodeValidator
impl Unpin for TimecodeValidator
impl UnsafeUnpin for TimecodeValidator
impl UnwindSafe for TimecodeValidator
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
Mutably borrows from an owned value. Read more