Browse Source

puts inline annotations behind a feature flag

this was to test cost in terms of compilation speed. doesn't seem like a
big deal but leaving it in case it is later.
master
Jonathan Strong 6 years ago
parent
commit
1f0ca41176
2 changed files with 6 additions and 4 deletions
  1. +2
    -0
      Cargo.toml
  2. +4
    -4
      src/influx.rs

+ 2
- 0
Cargo.toml View File

@@ -37,6 +37,7 @@ money = { path = "../money", version = "0.2" }
pubsub = { path = "../pubsub" }

[features]
default = ["inlines"]
no-thrash = []
trace = []
debug = []
@@ -48,3 +49,4 @@ scholes = []
no-influx-buffer = []
disable-short-uuid = []
warnings = []
inlines = []

+ 4
- 4
src/influx.rs View File

@@ -199,18 +199,18 @@ impl Clone for InfluxWriter {
impl InfluxWriter {
/// Sends the `OwnedMeasurement` to the serialization thread.
///
#[inline]
#[cfg_attr(feature = "inlines", inline)]
pub fn send(&self, m: OwnedMeasurement) -> Result<(), SendError<Option<OwnedMeasurement>>> {
self.tx.send(Some(m))
}

#[inline]
#[cfg_attr(feature = "inlines", inline)]
pub fn nanos(&self, d: DateTime<Utc>) -> i64 { nanos(d) as i64 }

#[inline]
#[cfg_attr(feature = "inlines", inline)]
pub fn dur_nanos(&self, d: Duration) -> i64 { dur_nanos(d) as i64 }

#[inline]
#[cfg_attr(feature = "inlines", inline)]
pub fn dur_nanos_u64(&self, d: Duration) -> u64 { dur_nanos(d).max(0) as u64 }

pub fn tx(&self) -> Sender<Option<OwnedMeasurement>> {


Loading…
Cancel
Save