pub struct Calendar3<'a, Selection> { /* private fields */ }Expand description
Calendar with 3 months on display.
Take this as sample for your own fancy calendar.
let mut style = CalendarStyle::default();
let mut day_styles = HashMap::default();
let mut state = CalendarState::<3, SingleSelection>::new();
state.set_step(1);
state.set_primary_idx(1);
state.set_today_policy(TodayPolicy::Index(1));
state.set_start_date(Local::now().date_naive());
Calendar3::new()
.direction(Direction::Vertical)
.locale(Locale::default())
.styles(style)
.title_align(Alignment::Left)
.day_styles(&day_styles)
.show_weekdays()
.block(Block::bordered())
.render(Rect::new(0,0,24,24), &mut buf, &mut state);
Implementations§
Source§impl<'a, Selection> Calendar3<'a, Selection>
impl<'a, Selection> Calendar3<'a, Selection>
pub fn new() -> Selfwhere
Selection: Default,
pub fn direction(self, direction: Direction) -> Self
Sourcepub fn show_weekdays(self) -> Self
pub fn show_weekdays(self) -> Self
Show weekday titles
Sourcepub fn styles(self, s: CalendarStyle) -> Self
pub fn styles(self, s: CalendarStyle) -> Self
Set the composite style.
Sourcepub fn select_style(self, style: Style) -> Self
pub fn select_style(self, style: Style) -> Self
Style for the selected tab.
Sourcepub fn focus_style(self, style: Style) -> Self
pub fn focus_style(self, style: Style) -> Self
Style for a focused tab.
Sourcepub fn day_styles(self, styles: &'a HashMap<NaiveDate, Style>) -> Self
pub fn day_styles(self, styles: &'a HashMap<NaiveDate, Style>) -> Self
Sets all the day-styles.
Sourcepub fn week_style(self, s: impl Into<Style>) -> Self
pub fn week_style(self, s: impl Into<Style>) -> Self
Set the week number style
Sourcepub fn weekday_style(self, s: impl Into<Style>) -> Self
pub fn weekday_style(self, s: impl Into<Style>) -> Self
Set the week day style
Sourcepub fn title_style(self, s: impl Into<Style>) -> Self
pub fn title_style(self, s: impl Into<Style>) -> Self
Set the month-name style.
Sourcepub fn title_align(self, a: Alignment) -> Self
pub fn title_align(self, a: Alignment) -> Self
Set the mont-name align.
Trait Implementations§
Source§impl<Selection> StatefulWidget for Calendar3<'_, Selection>where
Selection: CalendarSelection,
impl<Selection> StatefulWidget for Calendar3<'_, Selection>where
Selection: CalendarSelection,
Source§type State = CalendarState<3, Selection>
type State = CalendarState<3, Selection>
State associated with the stateful widget. Read more
Auto Trait Implementations§
impl<'a, Selection> Freeze for Calendar3<'a, Selection>
impl<'a, Selection> RefUnwindSafe for Calendar3<'a, Selection>where
Selection: RefUnwindSafe,
impl<'a, Selection> Send for Calendar3<'a, Selection>where
Selection: Send,
impl<'a, Selection> Sync for Calendar3<'a, Selection>where
Selection: Sync,
impl<'a, Selection> Unpin for Calendar3<'a, Selection>where
Selection: Unpin,
impl<'a, Selection> UnwindSafe for Calendar3<'a, Selection>where
Selection: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more