Skip to content

Commit

Permalink
types: drop Property trait entirely
Browse files Browse the repository at this point in the history
This trait is now only used on the `Type` type. Drop the trait, rename
the `from_` constructors, and remove unused parameters and type
parameters.

Most of the methods can now be constfns. Will do this in the next commit
since it's a bit annoying (mainly: can't use ?, have to be explicit
about early returns).
  • Loading branch information
apoelstra committed Mar 6, 2024
1 parent b25023d commit fdea7f6
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 200 deletions.
12 changes: 6 additions & 6 deletions src/miniscript/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -702,7 +702,7 @@ mod tests {
use sync::Arc;

use super::{Miniscript, ScriptContext, Segwitv0, Tap};
use crate::miniscript::types::{self, ExtData, Property, Type};
use crate::miniscript::types::{self, ExtData, Type};
use crate::miniscript::Terminal;
use crate::policy::Liftable;
use crate::prelude::*;
Expand Down Expand Up @@ -890,7 +890,7 @@ mod tests {

let pk_node = Terminal::Check(Arc::new(Miniscript {
node: Terminal::PkK(String::from("")),
ty: Type::from_pk_k::<Segwitv0>(),
ty: Type::pk_k(),
ext: types::extra_props::ExtData::pk_k::<Segwitv0>(),
phantom: PhantomData,
}));
Expand All @@ -899,7 +899,7 @@ mod tests {

let pkh_node = Terminal::Check(Arc::new(Miniscript {
node: Terminal::PkH(String::from("")),
ty: Type::from_pk_h::<Segwitv0>(),
ty: Type::pk_h(),
ext: types::extra_props::ExtData::pk_h::<Segwitv0>(),
phantom: PhantomData,
}));
Expand All @@ -920,7 +920,7 @@ mod tests {

let pkk_node = Terminal::Check(Arc::new(Miniscript {
node: Terminal::PkK(pk),
ty: Type::from_pk_k::<Segwitv0>(),
ty: Type::pk_k(),
ext: types::extra_props::ExtData::pk_k::<Segwitv0>(),
phantom: PhantomData,
}));
Expand All @@ -935,11 +935,11 @@ mod tests {
let pkh_ms: Segwitv0Script = Miniscript {
node: Terminal::Check(Arc::new(Miniscript {
node: Terminal::RawPkH(hash),
ty: Type::from_pk_h::<Segwitv0>(),
ty: Type::pk_h(),
ext: types::extra_props::ExtData::pk_h::<Segwitv0>(),
phantom: PhantomData,
})),
ty: Type::cast_check(Type::from_pk_h::<Segwitv0>()).unwrap(),
ty: Type::cast_check(Type::pk_h()).unwrap(),
ext: ExtData::cast_check(ExtData::pk_h::<Segwitv0>()),
phantom: PhantomData,
};
Expand Down
Loading

0 comments on commit fdea7f6

Please sign in to comment.