Skip to main content

hiero_sdk/mirror_query/
mod.rs

1// SPDX-License-Identifier: Apache-2.0
2
3mod any;
4mod subscribe;
5
6pub(crate) use any::AnyMirrorQueryData;
7pub use any::{
8    AnyMirrorQuery,
9    AnyMirrorQueryMessage,
10    AnyMirrorQueryResponse,
11};
12pub(crate) use subscribe::{
13    subscribe,
14    MirrorRequest,
15};
16
17use self::subscribe::MirrorQueryExecute;
18
19/// A query that can be executed on the Hiero mirror network.
20#[derive(Clone, Debug, Default)]
21pub struct MirrorQuery<D> {
22    pub(crate) data: D,
23    // Field needs to exist even though it currently does nothing
24    #[allow(dead_code)]
25    pub(crate) common: MirrorQueryCommon,
26}
27
28// intentionally inaccessable despite publicity.
29#[derive(Clone, Debug, Default)]
30pub struct MirrorQueryCommon {
31    // empty for now
32    // TODO: request_timeout
33}
34
35impl<D> MirrorQuery<D>
36where
37    D: MirrorQueryExecute + Default,
38{
39    /// Create a new query ready for configuration and execution.
40    #[must_use]
41    pub fn new() -> Self {
42        Self::default()
43    }
44}