[][src]Struct koyomi::Calendar

pub struct Calendar { /* fields omitted */ }

カレンダー

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

Methods

impl Calendar[src]

pub fn new(from: Date, until: Date) -> KoyomiResult<Self>[src]

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

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

pub fn build<'a>() -> CalendarBuilder<'a>[src]

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

pub fn from(&self) -> String[src]

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

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

pub fn make(&self) -> Vec<Date>[src]

pub fn until(&self) -> String[src]

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

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

impl Debug for Calendar[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.