pub struct Point { /* private fields */ }Expand description
A single time-series data point.
Combines a SeriesKey (measurement + tags), a timestamp, and one or more
typed field values. Fields are stored as a sorted Vec<(Arc<str>, FieldValue)>
for allocation efficiency and cache-friendly access.
Fields are private to ensure invariants (at least one field, valid field
names) are maintained — use Point::new() to construct.
Implementations§
Source§impl Point
impl Point
Sourcepub fn new(
series_key: SeriesKey,
fields: BTreeMap<String, FieldValue>,
timestamp: i64,
) -> Result<Point, SchemaError>
pub fn new( series_key: SeriesKey, fields: BTreeMap<String, FieldValue>, timestamp: i64, ) -> Result<Point, SchemaError>
Create a new point with validation.
Accepts a BTreeMap for ergonomic construction; internally converts
to a sorted Vec for cache-friendly storage.
§Errors
Returns SchemaError if the series key is invalid or fields are empty.
Sourcepub fn series_key(&self) -> &SeriesKey
pub fn series_key(&self) -> &SeriesKey
Returns the series key for this point.
Sourcepub fn fields(&self) -> &Vec<(Arc<str>, FieldValue)>
pub fn fields(&self) -> &Vec<(Arc<str>, FieldValue)>
Returns the field values as a sorted slice.
Sourcepub fn field(&self, key: &str) -> Option<&FieldValue>
pub fn field(&self, key: &str) -> Option<&FieldValue>
Look up a field value by key using binary search.
Sourcepub fn field_keys(&self) -> impl Iterator<Item = &str>
pub fn field_keys(&self) -> impl Iterator<Item = &str>
Returns an iterator over field keys.
Sourcepub fn set_field(&mut self, key: &str, value: FieldValue) -> bool
pub fn set_field(&mut self, key: &str, value: FieldValue) -> bool
Replace an existing field’s value in place, returning false when
the field is not present.
The field set is fixed at construction, so this cannot change the sort order or the point’s validity — it exists for the one caller that rewrites a value without rewriting the point: rescaling a decimal to its column’s declared scale on the write path.
Sourcepub fn measurement(&self) -> &str
pub fn measurement(&self) -> &str
Returns the measurement name (delegates to SeriesKey::measurement).
Returns the tag set (delegates to SeriesKey::tags).
Sourcepub fn tag(&self, key: &str) -> Option<&str>
pub fn tag(&self, key: &str) -> Option<&str>
Look up a tag value by key (delegates to SeriesKey::tag).
Sourcepub fn tag_keys(&self) -> impl Iterator<Item = &str>
pub fn tag_keys(&self) -> impl Iterator<Item = &str>
Iterator over tag keys (delegates to SeriesKey::tag_keys).
Sourcepub fn inject_tag(
&mut self,
key: impl Into<String>,
value: impl Into<String>,
) -> Result<(), SchemaError>
pub fn inject_tag( &mut self, key: impl Into<String>, value: impl Into<String>, ) -> Result<(), SchemaError>
Inject a tag into this point’s series key.
Inject a tag into this point’s series key using copy-on-write.
Delegates to SeriesKey::inject_tag which uses Arc::make_mut
to avoid unnecessary deep clones.
§Errors
Returns SchemaError if the tag name is invalid.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Point
impl<'de> Deserialize<'de> for Point
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Point, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Point, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl Serialize for Point
impl Serialize for Point
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl StructuralPartialEq for Point
Auto Trait Implementations§
impl Freeze for Point
impl RefUnwindSafe for Point
impl Send for Point
impl Sync for Point
impl Unpin for Point
impl UnsafeUnpin for Point
impl UnwindSafe for Point
Blanket Implementations§
impl<T> Allocation for T
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more