pub struct Config<TMsg> {
pub host: String,
pub port: u16,
pub org: String,
pub bucket: String,
pub token: String,
pub fn_input: fn(&Message<TMsg>) -> Option<Vec<LineProtocolItem>>,
}
Fields§
§host: String
§port: u16
§org: String
§bucket: String
§token: String
§fn_input: fn(&Message<TMsg>) -> Option<Vec<LineProtocolItem>>
Функция преобразования сообщения в строки протокола InfluxDB
§Примеры
§Заглушка
fn_input: |_| None,
§Сохранение Custom
fn_input: |msg: &Message<Custom>| {
let value = match &msg.data {
MsgData::Custom(data) => match data {
Custom::ValueInstantF64(data) => {
cmp_influxdb::ValueType::f64(*data)
}
_ => return None,
},
_ => return None,
};
let line = cmp_influxdb::LineProtocolItem::new(&msg.key, value, &msg.ts);
Some(vec![line])
},
Trait Implementations§
Auto Trait Implementations§
impl<TMsg> Freeze for Config<TMsg>
impl<TMsg> RefUnwindSafe for Config<TMsg>
impl<TMsg> Send for Config<TMsg>
impl<TMsg> Sync for Config<TMsg>
impl<TMsg> Unpin for Config<TMsg>
impl<TMsg> UnwindSafe for Config<TMsg>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more