fn message_to_record(&self, message: BrokerMessage) -> Result<Record, PvError> {
        if let Some(consumption) = message.power_consumption() {
            if let Some(time) = message.time_stamp() {
                Ok(Record::new(
                    time,
                    consumption,
                    pv_simulation_function(time.time()),
                ))
            } else {
                Err(PvError::InternalError(format!(
                    "No time stamp was specified for message: {:?}",
                    message
                )))
            }
        } else {
            Err(PvError::InternalError(format!(
                "No power consumption was specified for message: {:?}",
                message
            )))
        }
    }
/// Converts a message from the broker to a record for data output.
/// Fails if the message contains invalid / empty fields.
///
/// # Parameters
///
/// * `message` - the message from the broker
Converts a message from the broker to a record for data output.
Fails if the message contains invalid / empty fields.
Converts a message from the broker to a record for data output . Fails if the message contains invalid / empty fields .
fn message_to_record(&self, message: BrokerMessage) -> Result<Record, PvError> {
        if let Some(consumption) = message.power_consumption() {
            if let Some(time) = message.time_stamp() {
                Ok(Record::new(
                    time,
                    consumption,
                    pv_simulation_function(time.time()),
                ))
            } else {
                Err(PvError::InternalError(format!(
                    "No time stamp was specified for message: {:?}",
                    message
                )))
            }
        } else {
            Err(PvError::InternalError(format!(
                "No power consumption was specified for message: {:?}",
                message
            )))
        }
    }
fn message_to_record ( & self , message : BrokerMessage ) -> Result < Record , PvError > { if let Some ( consumption ) = message . power_consumption ( ) { if let Some ( time ) = message . time_stamp ( ) { Ok ( Record :: new ( time , consumption , pv_simulation_function ( time . time ( ) ) , ) ) } else { Err ( PvError :: InternalError ( format ! ( " " message ) ) ) } } else { Err ( PvError :: InternalError ( format ! ( " " message ) ) ) } }
Converts a message from the broker to a record for data output.
Converts a message from the broker to a record for data output .
&self
message
BrokerMessage
&self
message
BrokerMessage