Skip to main content

WriteInput

Trait WriteInput 

Source
pub trait WriteInput {
    // Required method
    fn into_lp_batches(
        self,
        opts: &WriteOptions,
    ) -> Box<dyn Iterator<Item = Result<Vec<u8>>> + Send>;
}
Expand description

A type that can be lazily serialised to InfluxDB line protocol for writing.

Pass anything that implements this trait to crate::Client::write.

TypeUse case
&str / StringPre-formatted line protocol (low-level escape hatch)
Vec<Point>Point builder API (pass ownership; clone a slice with .to_vec() if you must keep it)
[crate::write_dataframe::DataFrameWrite]polars DataFrame (polars feature)

Implementations return an iterator that yields one batch per HTTP request. The iterator is consumed lazily, so only one batch buffer lives in memory at a time even for million-point writes.

Required Methods§

Source

fn into_lp_batches( self, opts: &WriteOptions, ) -> Box<dyn Iterator<Item = Result<Vec<u8>>> + Send>

Lazily produce line-protocol batches, one per HTTP request.

Implementations should respect opts.batch_size. Errors per batch are returned in the iterator so partially-valid inputs can still send what they can.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl WriteInput for &str

Source§

fn into_lp_batches( self, _opts: &WriteOptions, ) -> Box<dyn Iterator<Item = Result<Vec<u8>>> + Send>

Source§

impl WriteInput for String

Source§

fn into_lp_batches( self, _opts: &WriteOptions, ) -> Box<dyn Iterator<Item = Result<Vec<u8>>> + Send>

Source§

impl WriteInput for Vec<Point>

Source§

fn into_lp_batches( self, opts: &WriteOptions, ) -> Box<dyn Iterator<Item = Result<Vec<u8>>> + Send>

Implementors§