Crate emoji_clock_2

source ·
Expand description

§Examples

#[cfg(feature = "time")]
{
  use time::Time;
  use emoji_clock_2::{Clock, Rounding};
  let clock = Clock::new(Time::from_hms(12, 29, 00).unwrap()).with_rounding(Rounding::Floor);
  assert_eq!("🕛", clock.to_string());
}
#[cfg(feature = "chrono")]
{
  use chrono::NaiveTime;
  use emoji_clock_2::{Clock, Meridiem};
  let am_clock = Clock::new(NaiveTime::from_hms_opt(9, 15, 00).unwrap()).with_meridiem(Meridiem::default());
  assert_eq!("🕤🌞", am_clock.to_string());
  let pm_clock = Clock::new(NaiveTime::from_hms_opt(21, 44, 00).unwrap()).with_meridiem(Meridiem{ am: '🌞', pm: '🌙' });
  assert_eq!("🕤🌙", pm_clock.to_string());
}

Structs§

Enums§

  • Strategies for rounding time to emoji clock precision (30-minute granularity)

Traits§

  • The common set of methods for time

Functions§

  • Returns the emoji clock with the correct hour hand and minute hand, accurate to 30-minute precision