Skip to content

Commit

Permalink
WIP adding lifetimes for new version of influx_db_client.
Browse files Browse the repository at this point in the history
  • Loading branch information
qwandor committed Jan 3, 2025
1 parent cd8d578 commit 3d4e274
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions homie-influx/src/influx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ pub async fn send_property_value(
/// Convert the value of the given Homie property to an InfluxDB value of the appropriate type, if
/// possible. Returns None if the datatype of the property is unknown, or there was an error parsing
/// the value.
fn influx_value_for_homie_property(property: &Property) -> Option<Value> {
fn influx_value_for_homie_property(property: &Property) -> Option<Value<'static>> {
let datatype = property.datatype?;
Some(match datatype {
Datatype::Integer => Value::Integer(property.value().ok()?),
Expand All @@ -44,12 +44,12 @@ fn influx_value_for_homie_property(property: &Property) -> Option<Value> {
}

/// Construct an InfluxDB `Point` corresponding to the given Homie property value update.
fn point_for_property_value(
fn point_for_property_value<'a>(
device: &Device,
node: &Node,
property: &Property,
timestamp: SystemTime,
) -> Option<Point> {
) -> Option<Point<'a>> {
let datatype = property.datatype?;
let value = influx_value_for_homie_property(property)?;

Expand Down
8 changes: 4 additions & 4 deletions mijia-homie/src/mijia-history-influx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,12 @@ async fn write_history(
Ok(())
}

fn point_for_record(
measurement: &str,
fn point_for_record<'a>(
measurement: &'a str,
mac_address: &MacAddress,
name: &str,
name: &'a str,
record: &HistoryRecord,
) -> Point {
) -> Point<'a> {
Point::new(measurement)
.add_timestamp(
record
Expand Down

0 comments on commit 3d4e274

Please sign in to comment.