-
Notifications
You must be signed in to change notification settings - Fork 145
Expand file tree
/
Copy pathoptions.rs
More file actions
57 lines (47 loc) · 1.47 KB
/
options.rs
File metadata and controls
57 lines (47 loc) · 1.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright the Vortex contributors
use std::any::Any;
use std::fmt::Debug;
use std::fmt::Display;
use std::hash::Hash;
use std::hash::Hasher;
use vortex_error::VortexResult;
use crate::aggregate_fn::typed::DynAggregateFn;
/// An opaque handle to aggregate function options.
pub struct AggregateFnOptions<'a> {
pub(super) inner: &'a dyn DynAggregateFn,
}
impl Display for AggregateFnOptions<'_> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
self.inner.options_display(f)
}
}
impl Debug for AggregateFnOptions<'_> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
self.inner.options_debug(f)
}
}
impl PartialEq for AggregateFnOptions<'_> {
fn eq(&self, other: &Self) -> bool {
self.inner.id() == other.inner.id() && self.inner.options_eq(other.inner.options_any())
}
}
impl Eq for AggregateFnOptions<'_> {}
impl Hash for AggregateFnOptions<'_> {
fn hash<H: Hasher>(&self, state: &mut H) {
self.inner.id().hash(state);
self.inner.options_hash(state);
}
}
impl AggregateFnOptions<'_> {
/// Serialize the options to a byte vector.
pub fn serialize(&self) -> VortexResult<Option<Vec<u8>>> {
self.inner.options_serialize()
}
}
impl<'a> AggregateFnOptions<'a> {
/// Return the underlying `Any` reference.
pub fn as_any(&self) -> &'a dyn Any {
self.inner.options_any()
}
}