pub struct Calendar { /* private fields */ }
Expand description
カレンダー
指定期間の日付を生成することができる
Implementations§
source§impl Calendar
impl Calendar
sourcepub fn new(from: Date, until: Date) -> KoyomiResult<Self>
pub fn new(from: Date, until: Date) -> KoyomiResult<Self>
カレンダーオブジェクトを生成する
Examples
use koyomi::{Calendar, Date};
let from = Date::from_ymd(2018, 1, 1).unwrap();
let until = Date::from_ymd(2018, 12, 31).unwrap();
let cal = Calendar::new(from, until);
assert!(cal.is_ok());
let from = Date::from_ymd(2018, 12, 31).unwrap();
let until = Date::from_ymd(2018, 1, 1).unwrap();
let cal = Calendar::new(from, until);
assert!(cal.is_err());
sourcepub fn build<'a>() -> CalendarBuilder<'a>
pub fn build<'a>() -> CalendarBuilder<'a>
カレンダーを生成するためのビルダーを返す
sourcepub fn from(&self) -> String
pub fn from(&self) -> String
開始日の文字列表現を返す
Examples
use koyomi::{Calendar, Date};
let from = Date::from_ymd(2018, 1, 1).unwrap();
let until = Date::from_ymd(2018, 12, 31).unwrap();
let cal = Calendar::new(from, until).unwrap();
assert_eq!(cal.from(), "2018-01-01");