ProvideDatetime

Trait ProvideDatetime 

Source
pub trait ProvideDatetime: Send + Sync {
    // Required methods
    fn provide_today(&self, offset: Option<i64>) -> Option<Datetime>;
    fn reset_today(&self);
}
Expand description

A trait for providing access to date.

Required Methods§

Source

fn provide_today(&self, offset: Option<i64>) -> Option<Datetime>

Provides the current date.

If no offset is specified, the local date should be chosen. Otherwise, the UTC date should be chosen with the corresponding offset in hours.

If this function returns None, Typst’s datetime function will return an error.

Note that most implementations should provide a date only or only very course time increments to ensure Typst’s incremental compilation cache is not disrupted too much.

Source

fn reset_today(&self)

Reset the current date for the next compilation.

Note that this is only relevant for those providers which actually provide the current date.

Implementations on Foreign Types§

Source§

impl<W: ProvideDatetime> ProvideDatetime for &W

Source§

impl<W: ProvideDatetime> ProvideDatetime for Box<W>

Source§

impl<W: ProvideDatetime> ProvideDatetime for Arc<W>

Implementors§