Struct koyomi::CalendarBuilder

source ·
pub struct CalendarBuilder<'a> { /* private fields */ }
Expand description

カレンダー用ビルダー

カレンダーの範囲指定には複数のユースケースがあるので、 それぞれに応じたカレンダーを生成するためのビルダー

  1. 特定年月のカレンダー
  2. 特定年のカレンダー
  3. 期間を年月で指定したカレンダー
  4. 期間を年で指定したカレンダー

Implementations§

カレンダーオブジェクトを生成する

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());

期間の始まりを指定する

Examples
use koyomi::Calendar;

let mut builder = Calendar::build();
builder.from("2018");

単一年または単一年月を指定する

Examples
use koyomi::Calendar;

let mut builder = Calendar::build();
builder.single("2018-01");

期間の終わりを指定する

Examples
use koyomi::Calendar;

let mut builder = Calendar::build();
builder.until("2018");

Trait Implementations§

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.