Skip to content
This repository has been archived by the owner on Nov 19, 2024. It is now read-only.

Commit

Permalink
break out hidden ctor
Browse files Browse the repository at this point in the history
  • Loading branch information
CyonAlexRDX committed Sep 30, 2024
1 parent 30f5f59 commit d965099
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 16 deletions.
Original file line number Diff line number Diff line change
@@ -1,21 +1,5 @@
use crate::prelude::*;

/// A type used to hide a constructor for some other type, use
/// it like this:
///
/// ```rust,ignore
/// pub struct ValidatedName {
/// hiding_ctor: HiddenConstructor,
/// pub name: String,
/// pub name_appended_to_name: String // validated!
/// }
/// ```
///
/// Making it impossible to create `ValidatedName` with invalid value!
///
#[derive(Clone, Default, Debug, PartialEq, Eq, Hash)]
pub struct HiddenConstructor;

// TODO figure out if we want this or `DerivedFactorInstances`? Or neither or both
/// A collection of collections of FactorInstances, all collections are disjoint,
/// i.e. no FactorInstance is present in more than one collection.
Expand Down
15 changes: 15 additions & 0 deletions src/types/hidden_constructor.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/// A type used to hide a constructor for some other type, use
/// it like this:
///
/// ```rust,ignore
/// pub struct ValidatedName {
/// hiding_ctor: HiddenConstructor,
/// pub name: String,
/// pub name_appended_to_name: String // validated!
/// }
/// ```
///
/// Making it impossible to create `ValidatedName` with invalid value!
///
#[derive(Clone, Default, Debug, PartialEq, Eq, Hash)]
pub struct HiddenConstructor;
2 changes: 2 additions & 0 deletions src/types/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
mod factor_sources_of_kind;
mod hd_signature;
mod hd_signature_input;
mod hidden_constructor;
mod invalid_transaction_if_neglected;
mod new_methods_on_sargon_types;
mod owned_types;
Expand All @@ -9,6 +10,7 @@ mod sargon_types;
pub(crate) use factor_sources_of_kind::*;
pub use hd_signature::*;
pub use hd_signature_input::*;
pub use hidden_constructor::*;
pub use invalid_transaction_if_neglected::*;
pub use new_methods_on_sargon_types::*;
pub use owned_types::*;
Expand Down

0 comments on commit d965099

Please sign in to comment.