Skip to main content

State

Struct State 

Source
pub struct State { /* private fields */ }
Available on crate feature calendar only.
Expand description

What the form holds. The end is kept at or after the start: moving the start moves the end with it, so the entry keeps its length. The last date of a repeat is kept on or after the start.

Implementations§

Source§

impl State

Source

pub fn new(draft: &Draft, time_zone: &TimeZone) -> Self

A form for a new entry over the span the calendar asked for.

Source

pub fn edit(entry: &Entry, time_zone: &TimeZone) -> Self

A form for changing entry.

Source

pub fn with_week_start(self, week_start: Weekday) -> Self

The day weeks start on in the date picker. Defaults to Monday.

Source

pub fn week_start(&self) -> Weekday

The day weeks start on in the date picker.

Source

pub fn id(&self) -> Option<EntryId>

The entry being changed, or None for a new one.

Source

pub fn is_new(&self) -> bool

Source

pub fn title(&self) -> &str

Source

pub fn is_all_day(&self) -> bool

Source

pub fn repeats(&self) -> Repeats

Source

pub fn interval(&self) -> u32

How many units pass between repeats, at least 1.

Source

pub fn stops(&self) -> Stops

Source

pub fn until(&self) -> Date

The last date of the repeat, used when it stops on a date.

Source

pub fn count(&self) -> u32

How many occurrences there are, used when the repeat stops after a number of them. At least 1.

Source

pub fn repeat(&self) -> Option<Repeat>

The repeat rule the form describes, or None when the entry does not repeat.

Source

pub fn tone(&self) -> Tone

Source

pub fn colour(&self) -> Option<Color>

The entry’s own colour, kept from the entry the form opened with until a tone is picked.

Source

pub fn with_colour_label(self, label: impl Into<String>) -> Self

Names the entry’s own colour in the colour menu and the read-only form, such as the name of the calendar it comes from. Without a name it is CUSTOM_COLOUR. Blank text clears it.

Source

pub fn colour_label(&self) -> Option<&str>

Source

pub fn location(&self) -> &str

Source

pub fn notes(&self) -> String

The notes as text. Notes the form opened with come back exactly as they were until they are edited; edited notes lose the space around them.

Source

pub fn notes_content(&self) -> &Content

The notes buffer, for drawing the notes in a text area of the app’s own.

Source

pub fn picker_month(&self) -> Option<Date>

The month the open date picker shows, as its first day, or None when no picker is open.

Source

pub fn interval_text(&self) -> &str

The text of the “every” field as typed, which may be blank.

Source

pub fn count_text(&self) -> &str

The text of the “after” field as typed, which may be blank.

Source

pub fn is_picking_until(&self) -> bool

Whether the date picker for the last date of the repeat is open.

Source

pub fn date(&self, field: Field) -> Date

The date of a field.

Source

pub fn time(&self, field: Field) -> u16

The time of a field, in minutes from midnight.

Source

pub fn times(&self, field: Field) -> Vec<TimeOfDay>

The times a field’s menu lists. The start’s is the whole day in order. The end’s begins just after the start when both are on the same day and carries on round midnight, so the times before the start, which would end the entry the next day, come last. The menu opens with the field’s time in the middle, filters as you type and takes a typed time off the TIME_STEP grid.

Source

pub fn picker(&self) -> Option<Field>

The start or end whose date picker is open.

Source

pub fn when(&self) -> When

The span the form describes.

Source

pub fn entry(&self, new_id: EntryId) -> Entry

The entry the form describes. A new entry takes new_id; a changed one keeps its own, along with what the form does not show: its tag, icon, emphasis and whether it is locked, movable or removable. A blank title becomes UNTITLED.

Source

pub fn update(&mut self, event: Event)

Trait Implementations§

Source§

impl Clone for State

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for State

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl !Freeze for State

§

impl !RefUnwindSafe for State

§

impl !Sync for State

§

impl Forget for State

§

impl Move for State

§

impl Send for State
where RawVecInner: Send, BoxRaw<Entry>: Send, RefCell<Internal<()>>: Send, Repr: Send,

§

impl Unpin for State
where *const u8 is !null: Unpin, Box<Entry>: Unpin, (): Unpin, *const u8: Unpin,

§

impl UnsafeUnpin for State

§

impl UnwindSafe for State
where RawVecInner: UnwindSafe, BoxRaw<Entry>: UnwindSafe, (): UnwindSafe, *const u8: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
Source§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
Source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<State, Message> IntoBoot<State, Message> for State

Source§

fn into_boot(self) -> (State, Task<Message>)

Turns some type into the initial state of some Application.
Source§

impl<T> MaybeClone for T

Source§

impl<T> MaybeDebug for T

Source§

impl<T> MaybeSend for T
where T: Send,

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more