pub fn write_field_iff_none(
        &mut self,
        f: DateTimeField,
        u: Option<DateTimeFieldValue>,
    ) -> Result<(), String> {
        use DateTimeField::*;

        if u.is_some() {
            match f {
                Year if self.year.is_none() => {
                    self.year = u;
                }
                Month if self.month.is_none() => {
                    self.month = u;
                }
                Day if self.day.is_none() => {
                    self.day = u;
                }
                Hour if self.hour.is_none() => {
                    self.hour = u;
                }
                Minute if self.minute.is_none() => {
                    self.minute = u;
                }
                Second if self.second.is_none() => {
                    self.second = u;
                }
                _ => return Err(format!("{} field set twice", f)),
            }
        }
        Ok(())
    }
/// Write to the specified field of a ParsedDateTime iff it is currently set
/// to None; otherwise generate an error to propagate to the user.
Write to the specified field of a ParsedDateTime iff it is currently set
to None; otherwise generate an error to propagate to the user.
Write to the specified field of a ParsedDateTime iff it is currently set to None ; otherwise generate an error to propagate to the user .
pub fn write_field_iff_none(
        &mut self,
        f: DateTimeField,
        u: Option<DateTimeFieldValue>,
    ) -> Result<(), String> {
        use DateTimeField::*;
        if u.is_some() {
            match f {
                Year if self.year.is_none() => {
                    self.year = u;
                }
                Month if self.month.is_none() => {
                    self.month = u;
                }
                Day if self.day.is_none() => {
                    self.day = u;
                }
                Hour if self.hour.is_none() => {
                    self.hour = u;
                }
                Minute if self.minute.is_none() => {
                    self.minute = u;
                }
                Second if self.second.is_none() => {
                    self.second = u;
                }
                _ => return Err(format!("{} field set twice", f)),
            }
        }
        Ok(())
    }
pub fn write_field_iff_none ( & mut self , f : DateTimeField , u : Option < DateTimeFieldValue > , ) -> Result < ( ) , String > { use DateTimeField :: * ; if u . is_some ( ) { match f { Year if self . year . is_none ( ) => { self . year = u ; } Month if self . month . is_none ( ) => { self . month = u ; } Day if self . day . is_none ( ) => { self . day = u ; } Hour if self . hour . is_none ( ) => { self . hour = u ; } Minute if self . minute . is_none ( ) => { self . minute = u ; } Second if self . second . is_none ( ) => { self . second = u ; } _ => return Err ( format ! ( " " f ) ) , } } Ok ( ( ) ) }
Write to the specified field of a ParsedDateTime iff it is currently set
to None; otherwise generate an error to propagate to the user.
Write to the specified field of a ParsedDateTime iff it is currently set to None ; otherwise generate an error to propagate to the user .
&mut self
f
DateTimeField
u
Option<DateTimeFieldValue>
&mut self
f
DateTimeField
u
Option<DateTimeFieldValue>