Skip to content

Commit

Permalink
feat: added prelude module to hipcheck_sdk
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickjcasey committed Sep 20, 2024
1 parent 47e236d commit 0036c7c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 15 deletions.
8 changes: 1 addition & 7 deletions plugins/dummy_rand_data_sdk/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,7 @@

use anyhow::Result;
use clap::Parser;
use hipcheck_sdk::{
deps::{async_trait, from_str, JsonSchema, Value},
error::Error,
plugin_engine::PluginEngine,
plugin_server::PluginServer,
NamedQuery, Plugin, Query,
};
use hipcheck_sdk::prelude::*;

static GET_RAND_KEY_SCHEMA: &str = include_str!("../schema/query_schema_get_rand.json");
static GET_RAND_OUTPUT_SCHEMA: &str = include_str!("../schema/query_schema_get_rand.json");
Expand Down
24 changes: 16 additions & 8 deletions sdk/rust/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
// SPDX-License-Identifier: Apache-2.0

mod proto {
include!(concat!(env!("OUT_DIR"), "/hipcheck.v1.rs"));
}

pub mod error;
pub mod plugin_engine;
pub mod plugin_server;

use crate::error::Error;
use crate::error::Result;
use error::ConfigError;
Expand All @@ -17,6 +9,22 @@ use serde_json::Value as JsonValue;
use std::result::Result as StdResult;
use std::str::FromStr;

mod proto {
include!(concat!(env!("OUT_DIR"), "/hipcheck.v1.rs"));
}

pub mod error;
pub mod plugin_engine;
pub mod plugin_server;

// utility module, so users can write `use hipcheck_sdk::prelude::*` and have everything they need to write a plugin
pub mod prelude {
pub use crate::deps::*;
pub use crate::error::{ConfigError, Error, Result};
pub use crate::plugin_engine::PluginEngine;
pub use crate::plugin_server::{PluginServer, QueryResult};
pub use crate::{DynQuery, NamedQuery, Plugin, Query, QuerySchema, QueryTarget};
}

// re-export of user facing third party dependencies
pub mod deps {
Expand Down

0 comments on commit 0036c7c

Please sign in to comment.