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" } pubsub = { path = "../pubsub" }


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

+ 4
- 4
src/influx.rs View File

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


#[inline]
#[cfg_attr(feature = "inlines", inline)]
pub fn nanos(&self, d: DateTime<Utc>) -> i64 { nanos(d) as i64 } 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 } 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 dur_nanos_u64(&self, d: Duration) -> u64 { dur_nanos(d).max(0) as u64 }


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


Loading…
Cancel
Save