[−][src]Struct utimeseries::TimeseriesWriter
Wraps a writer and writes blocks to it.
Methods
impl<T: Sized + Copy, W: Write> TimeseriesWriter<T, W>
[src]
pub fn create(
out: W,
block_length: u32,
start: SystemTime,
interval: Duration
) -> Result<Self, Error>
[src]
out: W,
block_length: u32,
start: SystemTime,
interval: Duration
) -> Result<Self, Error>
Creates a new TimeseriesWriter
and writes the file header.
Each block contains a header with a timestamp, and block_length
records of type T
.
pub fn create_with_ns(
out: W,
block_length: u32,
start: SystemTime,
interval_ns: u64
) -> Result<Self, Error>
[src]
out: W,
block_length: u32,
start: SystemTime,
interval_ns: u64
) -> Result<Self, Error>
Creates a new TimeseriesWriter
and writes the file header.
Each block contains a header with a timestamp, and block_length
records of type T
. The
interval is given in nanoseconds.
pub fn record_values(
&mut self,
offset: Duration,
values: &[T]
) -> Result<(), Error>
[src]
&mut self,
offset: Duration,
values: &[T]
) -> Result<(), Error>
Writes a new block; values
must have exactly block_length
entries.
pub fn get_ref(&self) -> &W
[src]
Gets a reference to the underlying writer.
pub fn get_mut(&mut self) -> &mut W
[src]
Gets a mutable reference to the underlying writer.
pub fn start_time(&self) -> SystemTime
[src]
The start time of the time series.
pub fn interval(&self) -> Duration
[src]
The interval of the time series.
impl<T: Sized + Copy, W: Write + Seek + Read> TimeseriesWriter<T, W>
[src]
pub fn append(out: W) -> Result<Self, Error>
[src]
Creates a new TimeseriesWriter
that appends to the given writer.
It reads the header from the beginning and then skips to the position after the last complete block. Additional blocks will be appended from there.
pub fn set_start_time(&mut self, start: SystemTime) -> Result<SystemTime, Error>
[src]
Updates the timeseries' start time, without changing any deltas. Returns the previous start time.
WARNING The underlying file must be opened in write mode. If it is in append mode, it will append garbage data to the end of the stream!
Trait Implementations
impl<T: Debug, W: Debug> Debug for TimeseriesWriter<T, W>
[src]
Auto Trait Implementations
impl<T, W> RefUnwindSafe for TimeseriesWriter<T, W> where
T: RefUnwindSafe,
W: RefUnwindSafe,
T: RefUnwindSafe,
W: RefUnwindSafe,
impl<T, W> Send for TimeseriesWriter<T, W> where
T: Send,
W: Send,
T: Send,
W: Send,
impl<T, W> Sync for TimeseriesWriter<T, W> where
T: Sync,
W: Sync,
T: Sync,
W: Sync,
impl<T, W> Unpin for TimeseriesWriter<T, W> where
T: Unpin,
W: Unpin,
T: Unpin,
W: Unpin,
impl<T, W> UnwindSafe for TimeseriesWriter<T, W> where
T: UnwindSafe,
W: UnwindSafe,
T: UnwindSafe,
W: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,