Skip to content

Commit

Permalink
fix: doctest for lib_ccxr module
Browse files Browse the repository at this point in the history
  • Loading branch information
IshanGrover2004 committed Jul 17, 2024
1 parent ca6a1bc commit a874271
Showing 1 changed file with 19 additions and 19 deletions.
38 changes: 19 additions & 19 deletions src/rust/lib_ccxr/src/time/units.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ pub enum TimestampFormat {
///
/// # Examples
/// ```rust
/// # use crate::time::units::{Timestamp, TimestampFormat};
/// # use lib_ccxr::time::units::{Timestamp, TimestampFormat};
/// let timestamp = Timestamp::from_millis(6524365);
/// let output = timestamp.to_formatted_time(TimestampFormat::None).unwrap();
/// assert_eq!(output, "");
Expand All @@ -56,7 +56,7 @@ pub enum TimestampFormat {
///
/// # Examples
/// ```rust
/// # use crate::time::units::{Timestamp, TimestampFormat};
/// # use lib_ccxr::time::units::{Timestamp, TimestampFormat};
/// let timestamp = Timestamp::from_millis(6524365);
/// let output = timestamp.to_formatted_time(TimestampFormat::HHMMSS).unwrap();
/// assert_eq!(output, "01:48:44");
Expand All @@ -67,7 +67,7 @@ pub enum TimestampFormat {
///
/// # Examples
/// ```rust
/// # use crate::time::units::{Timestamp, TimestampFormat};
/// # use lib_ccxr::time::units::{Timestamp, TimestampFormat};
/// let timestamp = Timestamp::from_millis(6524365);
/// let output = timestamp.to_formatted_time(
/// TimestampFormat::Seconds {
Expand All @@ -83,7 +83,7 @@ pub enum TimestampFormat {
///
/// # Examples
/// ```rust
/// # use crate::time::units::{Timestamp, TimestampFormat};
/// # use lib_ccxr::time::units::{Timestamp, TimestampFormat};
/// // 11 March 2023 14:53:36.749 in UNIX timestamp.
/// let timestamp = Timestamp::from_millis(1678546416749);
/// let output = timestamp.to_formatted_time(
Expand All @@ -99,7 +99,7 @@ pub enum TimestampFormat {
///
/// # Examples
/// ```rust
/// # use lib_ccxr::util::time::{Timestamp, TimestampFormat};
/// # use lib_ccxr::time::units::{Timestamp, TimestampFormat};
/// let timestamp = Timestamp::from_millis(6524365);
/// let output = timestamp.to_formatted_time(TimestampFormat::HHMMSSFFF).unwrap();
/// assert_eq!(output, "01:48:44,365");
Expand Down Expand Up @@ -155,7 +155,7 @@ impl Timestamp {
///
/// # Examples
/// ```rust
/// # use lib_ccxr::util::time::Timestamp;
/// # use lib_ccxr::time::units::Timestamp;;
/// let timestamp = Timestamp::from_millis(6524365);
/// assert_eq!(timestamp.millis(), 6524365);
/// ```
Expand All @@ -167,7 +167,7 @@ impl Timestamp {
///
/// # Examples
/// ```rust
/// # use lib_ccxr::util::time::Timestamp;
/// # use lib_ccxr::time::units::Timestamp;;
/// let timestamp = Timestamp::from_millis(6524365);
/// assert_eq!(timestamp.seconds(), 6524);
/// ```
Expand All @@ -181,7 +181,7 @@ impl Timestamp {
///
/// # Examples
/// ```rust
/// # use lib_ccxr::util::time::Timestamp;
/// # use lib_ccxr::time::units::Timestamp;;
/// let timestamp = Timestamp::from_millis(6524365);
/// assert_eq!(timestamp.as_sec_millis().unwrap(), (6524, 365));
/// ```
Expand All @@ -199,12 +199,12 @@ impl Timestamp {
///
/// # Examples
/// ```rust
/// # use lib_ccxr::util::time::Timestamp;
/// # use lib_ccxr::time::units::Timestamp;;
/// let timestamp = Timestamp::from_millis(6524365);
/// assert_eq!(timestamp.as_hms_millis().unwrap(), (1, 48, 44, 365));
/// ```
/// ```rust
/// # use lib_ccxr::util::time::{Timestamp, TimestampError};
/// # use lib_ccxr::time::units::{Timestamp, TimestampError};
/// let timestamp = Timestamp::from_millis(1678546416749);
/// assert!(matches!(
/// timestamp.as_hms_millis().unwrap_err(),
Expand All @@ -227,7 +227,7 @@ impl Timestamp {
///
/// # Examples
/// ```rust
/// # use lib_ccxr::util::time::Timestamp;
/// # use lib_ccxr::time::units::Timestamp;
/// let timestamp = Timestamp::from_millis(6524365);
/// let mut output = String::new();
/// timestamp.write_srt_time(&mut output);
Expand All @@ -243,7 +243,7 @@ impl Timestamp {
///
/// # Examples
/// ```rust
/// # use lib_ccxr::util::time::Timestamp;
/// # use lib_ccxr::time::units::Timestamp;
/// let timestamp = Timestamp::from_millis(6524365);
/// let mut output = String::new();
/// timestamp.write_vtt_time(&mut output);
Expand All @@ -261,7 +261,7 @@ impl Timestamp {
///
/// # Examples
/// ```rust
/// # use lib_ccxr::util::time::Timestamp;
/// # use lib_ccxr::time::units::Timestamp;
/// let timestamp = Timestamp::from_millis(6524365);
/// let mut output = String::new();
/// timestamp.write_hms_millis_time(&mut output, ':');
Expand All @@ -283,7 +283,7 @@ impl Timestamp {
///
/// # Examples
/// ```rust
/// # use lib_ccxr::util::time::Timestamp;
/// # use lib_ccxr::time::units::Timestamp;
/// let timestamp = Timestamp::from_millis(6524365);
/// let mut output = String::new();
/// timestamp.write_ctime(&mut output);
Expand Down Expand Up @@ -344,7 +344,7 @@ impl Timestamp {
///
/// # Examples
/// ```rust
/// # use lib_ccxr::util::time::Timestamp;
/// # use lib_ccxr::time::units::Timestamp;
/// let timestamp = Timestamp::from_millis(6524365);
/// assert_eq!(timestamp.to_srt_time().unwrap(), "01:48:44,365");
/// ```
Expand All @@ -358,7 +358,7 @@ impl Timestamp {
///
/// # Examples
/// ```rust
/// # use lib_ccxr::util::time::Timestamp;
/// # use lib_ccxr::time::units::Timestamp;
/// let timestamp = Timestamp::from_millis(6524365);
/// assert_eq!(timestamp.to_vtt_time().unwrap(), "01:48:44.365");
/// ```
Expand All @@ -374,7 +374,7 @@ impl Timestamp {
///
/// # Examples
/// ```rust
/// # use lib_ccxr::util::time::Timestamp;
/// # use lib_ccxr::time::units::Timestamp;
/// let timestamp = Timestamp::from_millis(6524365);
/// assert_eq!(timestamp.to_hms_millis_time(':').unwrap(), "01:48:44:365");
/// ```
Expand All @@ -388,7 +388,7 @@ impl Timestamp {
///
/// # Examples
/// ```rust
/// # use lib_ccxr::util::time::Timestamp;
/// # use lib_ccxr::time::units::Timestamp;
/// let timestamp = Timestamp::from_millis(6524365);
/// assert_eq!(timestamp.to_ctime().unwrap(), "Thu Jan 01 01:48:44 1970");
/// ```
Expand All @@ -411,7 +411,7 @@ impl Timestamp {
///
/// # Examples
/// ```rust
/// # use lib_ccxr::util::time::Timestamp;
/// # use lib_ccxr::time::units::Timestamp;
/// let timestamp = Timestamp::parse_optional_hhmmss_from_str("01:12:45").unwrap();
/// assert_eq!(timestamp, Timestamp::from_millis(4_365_000));
/// ```
Expand Down

0 comments on commit a874271

Please sign in to comment.