/
githubmirror
/
servo
Обзор
Документация
Войти
/
githubmirror
/
servo
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
components/webvtt/src/shared_test_setup.rs
26 строк
855 B
Tim van der Lippe
script: Parse vtt payload for track elements (#46383)
18 июл 2026, 21:00
Не верифицирован
18 июл 2026, 21:00
1123c30
Код
Авторство
О чём код?
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ use std::cell::RefCell; use crate::{IncrementalWebVTTParser, WebVttCue, WebVttParserSink}; pub fn compute_result_in_seconds(hours: f64, minutes: f64, seconds: f64, thousands: f64) -> f64 { hours * 60. * 60. + minutes * 60. + seconds + thousands / 1000. } #[derive(Default)] pub struct DummySink { pub collected_cues: RefCell<Vec<WebVttCue>>, } impl WebVttParserSink<()> for DummySink { fn consume_cue(&self, _: &mut (), cue: WebVttCue) { self.collected_cues.borrow_mut().push(cue); } } pub fn parser_with_dummy_sink() -> IncrementalWebVTTParser<(), DummySink> { IncrementalWebVTTParser::new(DummySink::default()) }