Struct koyomi::CalendarBuilder
source · pub struct CalendarBuilder<'a> { /* private fields */ }
Expand description
カレンダー用ビルダー
カレンダーの範囲指定には複数のユースケースがあるので、 それぞれに応じたカレンダーを生成するためのビルダー
- 特定年月のカレンダー
- 特定年のカレンダー
- 期間を年月で指定したカレンダー
- 期間を年で指定したカレンダー
Implementations§
source§impl<'a> CalendarBuilder<'a>
impl<'a> CalendarBuilder<'a>
sourcepub fn finalize(&self) -> KoyomiResult<Calendar>
pub fn finalize(&self) -> KoyomiResult<Calendar>
カレンダーオブジェクトを生成する
Examples
use koyomi::Calendar;
let builder = Calendar::build().single("2018").finalize();
assert!(builder.is_ok());
let builder = Calendar::build().from("2018").until("2019").finalize();
assert!(builder.is_ok());
let builder = Calendar::build().from("January").finalize();
assert!(builder.is_err());
sourcepub fn from(self, from: &'a str) -> Self
pub fn from(self, from: &'a str) -> Self
期間の始まりを指定する
Examples
use koyomi::Calendar;
let mut builder = Calendar::build();
builder.from("2018");