summaryrefslogtreecommitdiffstats
path: root/src/db/model
diff options
context:
space:
mode:
Diffstat (limited to 'src/db/model')
-rw-r--r--src/db/model/mod.rs19
-rw-r--r--src/db/model/state.rs12
2 files changed, 7 insertions, 24 deletions
diff --git a/src/db/model/mod.rs b/src/db/model/mod.rs
index 741f1f4..acfcda5 100644
--- a/src/db/model/mod.rs
+++ b/src/db/model/mod.rs
@@ -193,7 +193,7 @@ impl CandidateRow {
}
}
-pub fn json_or<T: serde::de::DeserializeOwned>(s: &str, fallback: T) -> T {
+pub(crate) fn json_or<T: serde::de::DeserializeOwned>(s: &str, fallback: T) -> T {
serde_json::from_str(s).unwrap_or(fallback)
}
@@ -202,16 +202,7 @@ pub fn json_or<T: serde::de::DeserializeOwned>(s: &str, fallback: T) -> T {
mod build_state;
mod state;
-pub use build_state::{
- BUILD_STEPS,
- BuildState,
- StepState,
-};
-pub use state::{
- CandidateState,
- ReleaseState,
- StateEnum,
- SubscriptionState,
- candidate_kind,
- notice_kind,
-};
+pub(crate) use state::StateEnum;
+
+pub use build_state::{BUILD_STEPS, BuildState, StepState};
+pub use state::{CandidateState, ReleaseState, SubscriptionState, candidate_kind, notice_kind};
diff --git a/src/db/model/state.rs b/src/db/model/state.rs
index 4882428..777840f 100644
--- a/src/db/model/state.rs
+++ b/src/db/model/state.rs
@@ -53,7 +53,7 @@ impl CandidateState {
}
}
- pub fn predecessors(to: CandidateState) -> Vec<&'static str> {
+ pub(crate) fn predecessors(to: CandidateState) -> Vec<&'static str> {
CandidateState::ALL
.iter()
.filter(|from| from.can_transition(to))
@@ -118,10 +118,9 @@ impl std::fmt::Display for ReleaseState {
}
}
-pub trait StateEnum: Copy + Sized {
+pub(crate) trait StateEnum: Copy + Sized {
const KIND: &'static str;
fn parse(text: &str) -> Option<Self>;
- fn as_str(&self) -> &'static str;
}
macro_rules! impl_state_enum {
@@ -131,9 +130,6 @@ macro_rules! impl_state_enum {
fn parse(text: &str) -> Option<Self> {
<$t>::parse(text)
}
- fn as_str(&self) -> &'static str {
- <$t>::as_str(self)
- }
}
};
}
@@ -147,12 +143,8 @@ impl_state_enum!(SubscriptionState, "subscription");
pub mod notice_kind {
pub const PIN_DRIFT: &str = "pin_drift";
pub const RECIPE_DRIFT: &str = "recipe_drift";
- pub const DIGEST_DRIFT: &str = "digest_drift";
pub const INTEGRITY_ALERT: &str = "integrity_alert";
- pub const UNPINABLE_PKGVER: &str = "unpinable_pkgver";
- pub const ORPHANED: &str = "orphaned";
pub const DELETED: &str = "deleted";
- pub const RENAMED: &str = "renamed";
pub const DOWNGRADE: &str = "downgrade";
}