Struct koyomi::Calendar

source ·
pub struct Calendar { /* private fields */ }
Expand description

カレンダー

指定期間の日付を生成することができる

Implementations§

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

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

カレンダーを生成するためのビルダーを返す

開始日の文字列表現を返す

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

終了日の文字列表現を返す

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.until(), "2018-12-31");

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.