redis_zset_ts/
lib.rs

1// redis-zset-ts/src/lib.rs
2//
3// Copyright (c) 2024, Frank Pagliughi <fpagliughi@mindspring.com>
4// All Rights Reserved
5//
6// Licensed under the MIT license:
7//   <LICENSE or http://opensource.org/licenses/MIT>
8// This file may not be copied, modified, or distributed except according
9// to those terms.
10//
11
12//! Simple time-series database functionality using Redis Sorted 'Z' Sets.
13//!
14
15// Lints
16#![deny(
17    missing_docs,
18    missing_copy_implementations,
19    trivial_casts,
20    trivial_numeric_casts,
21    unsafe_code,
22    unstable_features,
23    unused_import_braces,
24    unused_qualifications
25)]
26
27use rmp_serde as rmps;
28
29mod time_series;
30pub use time_series::{TimeSeries, Timestamp, TimeValue};
31
32/// Errors for this library
33#[derive(thiserror::Error, Debug)]
34pub enum Error {
35    /// Low-level I/O error
36    #[error(transparent)]
37    Io(#[from] std::io::Error),
38    /// MsgPack serialization error
39    #[error(transparent)]
40    MsgPackEncode(#[from] rmps::encode::Error),
41    /// MsgPack deserialization error
42    #[error(transparent)]
43    MsgPackDecode(#[from] rmps::decode::Error),
44    /// Redis Error
45    #[error(transparent)]
46    Redis(#[from] redis::RedisError),
47}
48
49/// The result type to use for the library
50pub type Result<T> = std::result::Result<T, Error>;