Trait libimagentrydatetime::datetime::EntryDate
[−]
[src]
pub trait EntryDate { fn delete_date(&mut self) -> Result<()>; fn read_date(&self) -> Result<NaiveDateTime>; fn set_date(
&mut self,
d: NaiveDateTime
) -> Result<Option<Result<NaiveDateTime>>>; fn delete_date_range(&mut self) -> Result<()>; fn read_date_range(&self) -> Result<DateTimeRange>; fn set_date_range(
&mut self,
start: NaiveDateTime,
end: NaiveDateTime
) -> Result<Option<Result<DateTimeRange>>>; }
Required Methods
fn delete_date(&mut self) -> Result<()>
fn read_date(&self) -> Result<NaiveDateTime>
fn set_date(
&mut self,
d: NaiveDateTime
) -> Result<Option<Result<NaiveDateTime>>>
&mut self,
d: NaiveDateTime
) -> Result<Option<Result<NaiveDateTime>>>
fn delete_date_range(&mut self) -> Result<()>
fn read_date_range(&self) -> Result<DateTimeRange>
fn set_date_range(
&mut self,
start: NaiveDateTime,
end: NaiveDateTime
) -> Result<Option<Result<DateTimeRange>>>
&mut self,
start: NaiveDateTime,
end: NaiveDateTime
) -> Result<Option<Result<DateTimeRange>>>
Implementations on Foreign Types
impl EntryDate for Entry
[src]
fn delete_date(&mut self) -> Result<()>
[src]
fn read_date(&self) -> Result<NaiveDateTime>
[src]
fn set_date(
&mut self,
d: NaiveDateTime
) -> Result<Option<Result<NaiveDateTime>>>
[src]
&mut self,
d: NaiveDateTime
) -> Result<Option<Result<NaiveDateTime>>>
Set a Date for this entry
Return value
This function returns funny things, I know. But I find it more attractive to be explicit what failed when here, instead of beeing nice to the user here.
So here's a list how things are returned:
- Err(_) if the inserting failed
- Ok(None) if the inserting succeeded and did not replace an existing value.
- Ok(Some(Ok(_))) if the inserting succeeded, but replaced an existing value which then got parsed into a NaiveDateTime object
- Ok(Some(Err(_))) if the inserting succeeded, but replaced an existing value which then got parsed into a NaiveDateTime object, where the parsing failed for some reason.
fn delete_date_range(&mut self) -> Result<()>
[src]
Deletes the date range
Warning
First deletes the start, then the end. If the first operation fails, this might leave the header in an inconsistent state.
fn read_date_range(&self) -> Result<DateTimeRange>
[src]
fn set_date_range(
&mut self,
start: NaiveDateTime,
end: NaiveDateTime
) -> Result<Option<Result<DateTimeRange>>>
[src]
&mut self,
start: NaiveDateTime,
end: NaiveDateTime
) -> Result<Option<Result<DateTimeRange>>>
Set the date range
Warning
This first sets the start, then the end. If the first operation fails, this might leave the header in an inconsistent state.