Skip to content

Commit 20dd79c

Browse files
committed
rust doc fixes
1 parent a300697 commit 20dd79c

File tree

12 files changed

+69
-68
lines changed

12 files changed

+69
-68
lines changed

src/descriptor/csfs_cov/cov.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -193,8 +193,7 @@ impl<Pk: MiniscriptKey, Ext: Extension> LegacyCSFSCov<Pk, Ext> {
193193

194194
/// Script code for signing with covenant publickey.
195195
/// Use this script_code for sighash method when signing
196-
/// with the covenant pk. Use the [DescriptorTrait] script_code
197-
/// method for getting sighash for regular miniscripts.
196+
/// with the covenant pk.
198197
pub fn cov_script_code(&self) -> Script
199198
where
200199
Pk: ToPublicKey,
@@ -279,8 +278,8 @@ impl<Ext: ParseableExt> LegacyCSFSCov<bitcoin::PublicKey, Ext> {
279278
}
280279

281280
/// Parse a descriptor with additional local sanity checks.
282-
/// See [Miniscript::sanity_check] for all the checks. Use
283-
/// [parse_insane] to allow parsing insane scripts
281+
/// See [`Miniscript::sanity_check`] for all the checks. Use
282+
/// [`Miniscript::parse_insane`] to allow parsing insane scripts
284283
pub fn parse(script: &script::Script) -> Result<Self, Error> {
285284
let cov = Self::parse_insane(script)?;
286285
cov.ms.sanity_check()?;
@@ -430,7 +429,7 @@ where
430429

431430
/// This returns the entire explicit script as the script code.
432431
/// You will need this script code when singing with pks that
433-
/// inside Miniscript. Use the [cov_script_code] method to
432+
/// inside Miniscript. Use the [`Self::cov_script_code`] method to
434433
/// get the script code for signing with covenant pk
435434
pub fn ecdsa_sighash_script_code(&self) -> Script
436435
where

src/descriptor/csfs_cov/script_internals.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ pub trait CovOperations: Sized {
2727
/// len must be 33
2828
fn chk_amt(self) -> Self;
2929
/// Assuming the 10 sighash components + 1 sig on the top of
30-
/// stack for segwit sighash as created by [init_stack]
30+
/// stack for segwit sighash as created by init_stack
3131
/// CAT all of them and check sig from stack
3232
fn verify_cov(self, key: &bitcoin::PublicKey) -> Self;
3333

src/descriptor/mod.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,8 @@ pub enum DescriptorInfo {
175175
},
176176
/// Pegin descriptor
177177
/// Only provides information about the bitcoin side of descriptor
178-
/// Use [DescriptorTrait::user_desc] method to obtain the user descriptor
178+
/// Use the corresponding [`pegin::LegacyPegin::into_user_descriptor`] or
179+
/// [`pegin::Pegin::into_user_descriptor`] method to obtain the user descriptor.
179180
/// and call DescriptorType method on it on to find information about
180181
/// the user claim descriptor.
181182
Pegin {
@@ -187,12 +188,12 @@ pub enum DescriptorInfo {
187188
}
188189

189190
impl DescriptorInfo {
190-
/// Compute the [DescriptorInfo] for the given descriptor string
191+
/// Compute the [`DescriptorInfo`] for the given descriptor string
191192
/// This method should when the user is unsure whether they are parsing
192193
/// Bitcoin Descriptor, Elements Descriptor or Pegin Descriptors.
193194
/// This also returns information whether the descriptor contains any secrets
194-
/// of the type [DescriptorSecretKey]. If the descriptor contains secret, users
195-
/// should use the method [DescriptorPublicKey::parse_descriptor] to obtain the
195+
/// of the type [`DescriptorSecretKey`]. If the descriptor contains secret, users
196+
/// should use the method [`Descriptor::parse_descriptor`] to obtain the
196197
/// Descriptor and a secret key to public key mapping
197198
pub fn from_desc_str<T: Extension>(s: &str) -> Result<Self, Error> {
198199
// Parse as a string descriptor

src/descriptor/pegin/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,5 @@
2424
2525
pub mod dynafed_pegin;
2626
pub mod legacy_pegin;
27+
pub use self::dynafed_pegin::Pegin;
2728
pub use self::legacy_pegin::{LegacyPegin, LegacyPeginKey};

src/extensions/arith.rs

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -34,63 +34,63 @@ use crate::{
3434
pub enum ExprInner {
3535
/* leaf fragments/terminals */
3636
/// A constant i64 value
37-
/// Minimal push of this <i64>
37+
/// Minimal push of this `<i64>`
3838
Const(i64),
3939
/// Value under the current executing input
40-
/// INSPECTCURRENTINPUTINDEX INPSECTINPUTVALUE <1> EQUALVERIFY
40+
/// `INSPECTCURRENTINPUTINDEX INPSECTINPUTVALUE <1> EQUALVERIFY`
4141
CurrInputIdx,
4242
/// Explicit amount at the given input index
43-
/// i INPSECTINPUTVALUE <1> EQUALVERIFY
43+
/// `i INPSECTINPUTVALUE <1> EQUALVERIFY`
4444
Input(IdxExpr),
4545
/// Explicit amount at the given output index
46-
/// i INPSECTOUTPUTVALUE <1> EQUALVERIFY
46+
/// `i INPSECTOUTPUTVALUE <1> EQUALVERIFY`
4747
Output(IdxExpr),
4848
/// Explicit issuance amount at this input index
49-
/// i OP_INSPECTINPUTISSUANCE DROP DROP <1> EQUALVERIFY NIP NIP
49+
/// `i OP_INSPECTINPUTISSUANCE DROP DROP <1> EQUALVERIFY NIP NIP`
5050
// NIP drops the second to top stack item
5151
// issuance stack after push where the right is stack top
5252
// [<inflation keys> <inflation_pref> <value> <value_pref> <entropy> <blindingnonce>]
5353
InputIssue(IdxExpr),
5454
/// Explicit re-issuance amount at this input index
55-
/// i OP_INSPECTINPUTISSUANCE DROP DROP DROP DROP <1> EQUALVERIFY
55+
/// `i OP_INSPECTINPUTISSUANCE DROP DROP DROP DROP <1> EQUALVERIFY`
5656
// issuance stack after push where the right is stack top
5757
// [<inflation keys> <inflation_pref> <value> <value_pref> <entropy> <blindingnonce>]
5858
InputReIssue(IdxExpr),
5959

6060
/* Two children */
6161
/// Add two Arith expressions.
62-
/// [X] [Y] ADD64 <1> EQUALVERIFY
62+
/// `[X] [Y] ADD64 <1> EQUALVERIFY`
6363
Add(Box<Expr>, Box<Expr>),
6464
/// Subtract (X-Y)
65-
/// [X] [Y] SUB64 <1> EQUALVERIFY
65+
/// `[X] [Y] SUB64 <1> EQUALVERIFY`
6666
Sub(Box<Expr>, Box<Expr>),
6767
/// Multiply two Expr expressions. (a*b)
68-
/// [X] [Y] MUL64 <1> EQUALVERIFY
68+
/// `[X] [Y] MUL64 <1> EQUALVERIFY`
6969
Mul(Box<Expr>, Box<Expr>),
7070
/// Divide two Expr expressions. (a//b)
7171
/// The division operation pushes the quotient(a//b) such that the remainder a%b
7272
/// (must be non-negative and less than |b|).
73-
/// [X] [Y] DIV64 <1> EQUALVERIFY NIP
73+
/// `[X] [Y] DIV64 <1> EQUALVERIFY NIP`
7474
Div(Box<Expr>, Box<Expr>),
7575
/// Modulo operation (a % b)
7676
/// The division operation the remainder a%b (must be non-negative and less than |b|).
77-
/// [X] [Y] DIV64 <1> EQUALVERIFY DROP
77+
/// `[X] [Y] DIV64 <1> EQUALVERIFY DROP`
7878
Mod(Box<Expr>, Box<Expr>),
7979
/// BitWise And (a & b)
80-
/// [X] [Y] AND (cannot fail)
80+
/// `[X] [Y] AND` (cannot fail)
8181
BitAnd(Box<Expr>, Box<Expr>),
8282
/// BitWise or (a | b)
83-
/// [X] [Y] OR (cannot fail)
83+
/// `[X] [Y] OR` (cannot fail)
8484
BitOr(Box<Expr>, Box<Expr>),
8585
/// BitWise or (a ^ b)
86-
/// [X] [Y] XOR (cannot fail)
86+
/// `[X] [Y] XOR` (cannot fail)
8787
Xor(Box<Expr>, Box<Expr>),
8888
/* One child*/
8989
/// BitWise invert (!a)
90-
/// [X] INVERT (cannot fail)
90+
/// `[X] INVERT` (cannot fail)
9191
Invert(Box<Expr>),
9292
/// Negate -a
93-
/// [X] NEG64 <1> EQUALVERIFY
93+
/// `[X] NEG64 <1> EQUALVERIFY`
9494
Negate(Box<Expr>),
9595
}
9696

@@ -528,19 +528,19 @@ impl Expr {
528528
#[derive(Eq, PartialEq, Ord, PartialOrd, Hash, Clone)]
529529
pub enum Arith {
530530
/// Eq
531-
/// [X] [Y] EQUAL
531+
/// `[X] [Y] EQUAL`
532532
Eq(Expr, Expr),
533533
/// Lt
534-
/// [X] [Y] LESSTHAN
534+
/// `[X] [Y] LESSTHAN`
535535
Lt(Expr, Expr),
536536
/// Leq
537-
/// [X] [Y] LESSTHANOREQUAL
537+
/// `[X] [Y] LESSTHANOREQUAL`
538538
Leq(Expr, Expr),
539539
/// Gt
540-
/// [X] [Y] GREATERTHAN
540+
/// `[X] [Y] GREATERTHAN`
541541
Gt(Expr, Expr),
542542
/// Geq
543-
/// [X] [Y] GREATERTHANOREQUAL
543+
/// `[X] [Y] GREATERTHANOREQUAL`
544544
Geq(Expr, Expr),
545545
}
546546

src/extensions/index_ops.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,26 +17,26 @@ use crate::{expression, script_num_size, Error};
1717
pub enum IdxExpr {
1818
/* leaf fragments/terminals */
1919
/// A constant
20-
/// <i> as CScriptNum
20+
/// `<i>` as CScriptNum
2121
Const(usize),
2222
/// Current Input index
2323
CurrIdx,
2424
/// Add two IdxExpr
25-
/// [X] [Y] ADD`
25+
/// `[X] [Y] ADD`
2626
Add(Box<IdxExpr>, Box<IdxExpr>),
2727
/// Subtract two IdxExpr
28-
/// [X] [Y] SUB`
28+
/// `[X] [Y] SUB`
2929
Sub(Box<IdxExpr>, Box<IdxExpr>),
3030
/// Multiply two IdxExpr
31-
/// [X] SCIPTNUMTOLE64 [Y] SCIPTNUMTOLE64 MUL64 <1> EQUALVERIFY LE64TOSCIPTNUM`
31+
/// `[X] SCIPTNUMTOLE64 [Y] SCIPTNUMTOLE64 MUL64 <1> EQUALVERIFY LE64TOSCIPTNUM`
3232
Mul(Box<IdxExpr>, Box<IdxExpr>),
3333
/// Divide two IdxExpr (integer division)
34-
/// [X] SCIPTNUMTOLE64 [Y] SCIPTNUMTOLE64 DIV64 <1> EQUALVERIFY NIP LE64TOSCIPTNUM`
34+
/// `[X] SCIPTNUMTOLE64 [Y] SCIPTNUMTOLE64 DIV64 <1> EQUALVERIFY NIP LE64TOSCIPTNUM`
3535
Div(Box<IdxExpr>, Box<IdxExpr>),
3636
}
3737

3838
impl IdxExpr {
39-
/// Returns the script size of this [`AssetExpr<T>`].
39+
/// Returns the script size of this [`IdxExpr`].
4040
pub fn script_size(&self) -> usize {
4141
match self {
4242
IdxExpr::Const(i) => script_num_size(*i),
@@ -157,7 +157,7 @@ impl IdxExpr {
157157
}
158158

159159
/// Returns (self, start_pos) parsed reversed form tokens starting with index end_pos
160-
/// Expression is parsed from tokens[start:end_pos]
160+
/// Expression is parsed from tokens `[start:end_pos]`
161161
#[rustfmt::skip]
162162
pub fn from_tokens(tokens: &[Tk], end_pos: usize) -> Option<(Self, usize)> {
163163
let tks = tokens;

src/extensions/introspect_ops.rs

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -34,16 +34,16 @@ use crate::{
3434
pub enum AssetExpr<T: ExtParam> {
3535
/* leaf fragments/terminals */
3636
/// A constant asset id
37-
/// Minimal push of this <asset_id>
37+
/// Minimal push of this `<asset_id>`
3838
Const(T),
3939
/// Asset under the current executing input
40-
/// INSPECTCURRENTINPUTINDEX INPSECTINPUTASSET
40+
/// `INSPECTCURRENTINPUTINDEX INPSECTINPUTASSET`
4141
CurrInputAsset,
4242
/// Explicit asset at the given input index
43-
/// i INPSECTINPUTASSET
43+
/// `i INPSECTINPUTASSET`
4444
Input(IdxExpr),
4545
/// Explicit asset at the given output index
46-
/// i INPSECTOUTPUTASSET
46+
/// `i INPSECTOUTPUTASSET`
4747
Output(IdxExpr),
4848
}
4949

@@ -58,13 +58,13 @@ pub enum ValueExpr<T: ExtParam> {
5858
/// A constant Value
5959
Const(T),
6060
/// Value under the current executing input
61-
/// INSPECTCURRENTINPUTINDEX INPSECTINPUTVALUE
61+
/// `INSPECTCURRENTINPUTINDEX INPSECTINPUTVALUE`
6262
CurrInputValue,
6363
/// Value(possibly confidential) at the given input index
64-
/// i INPSECTINPUTVALUE
64+
/// `i INPSECTINPUTVALUE`
6565
Input(IdxExpr),
6666
/// Value(possibly confidential) at the given output index
67-
/// i INPSECTOUTPUTVALUE
67+
/// `i INPSECTOUTPUTVALUE`
6868
Output(IdxExpr),
6969
}
7070

@@ -82,13 +82,13 @@ pub enum SpkExpr<T: ExtParam> {
8282
/// Pushes -1 if the legacy script pubkeys followed by sha256 hash of script pubkey
8383
Const(T),
8484
/// Script pubkey under the current executing input
85-
/// INSPECTCURRENTINPUTINDEX INPSECTINPUTSCRIPTPUBKEY
85+
/// `INSPECTCURRENTINPUTINDEX INPSECTINPUTSCRIPTPUBKEY`
8686
CurrInputSpk,
8787
/// Explicit asset at the given input index
88-
/// i INPSECTINPUTSCRIPTPUBKEY
88+
/// `i INPSECTINPUTSCRIPTPUBKEY`
8989
Input(IdxExpr),
9090
/// Explicit asset at the given output index
91-
/// i INPSECTOUTPUTSCRIPTPUBKEY
91+
/// `i INPSECTOUTPUTSCRIPTPUBKEY`
9292
Output(IdxExpr),
9393
}
9494

@@ -99,28 +99,28 @@ pub enum SpkExpr<T: ExtParam> {
9999
#[derive(Eq, PartialEq, Ord, PartialOrd, Hash, Clone)]
100100
pub enum CovOps<T: ExtParam> {
101101
/// Checks that asset is explicit
102-
/// [X] <1> EQUAL NIP
102+
/// `[X] <1> EQUAL NIP`
103103
IsExpAsset(AssetExpr<T>),
104104
/// Checks if the value is explicit
105-
/// [X] <1> EQUAL NIP
105+
/// `[X] <1> EQUAL NIP`
106106
/// The script translation is same as that of IsExpAsset, but the data structure
107107
/// distinguishes them for clarity.
108108
IsExpValue(ValueExpr<T>),
109109
/// Checks that both assets are equal (maybe confidential)
110-
/// [X] TOALTSTACK [Y] FROMALTSTACK EQUAL TOALTSTACK EQUAL FROMALTSTACK BOOLAND
110+
/// `[X] TOALTSTACK [Y] FROMALTSTACK EQUAL TOALTSTACK EQUAL FROMALTSTACK BOOLAND`
111111
AssetEq(AssetExpr<T>, AssetExpr<T>),
112112
/// Checks that both values are equal (maybe confidential)
113-
/// [X] TOALTSTACK [Y] FROMALTSTACK EQUAL TOALTSTACK EQUAL FROMALTSTACK BOOLAND
113+
/// `[X] TOALTSTACK [Y] FROMALTSTACK EQUAL TOALTSTACK EQUAL FROMALTSTACK BOOLAND`
114114
ValueEq(ValueExpr<T>, ValueExpr<T>),
115115
/// Script pubkey equal. Checks the witness version and program. Also works for
116116
/// legacy programs.
117-
/// [X] TOALTSTACK [Y] FROMALTSTACK EQUAL TOALTSTACK EQUAL FROMALTSTACK BOOLAND
117+
/// `[X] TOALTSTACK [Y] FROMALTSTACK EQUAL TOALTSTACK EQUAL FROMALTSTACK BOOLAND`
118118
SpkEq(SpkExpr<T>, SpkExpr<T>),
119119
/// Current input index equality
120-
/// <i> PUSHCURRENTINPUTINDEX EQUAL
120+
/// `<i> PUSHCURRENTINPUTINDEX EQUAL`
121121
CurrIndEq(usize),
122122
/// Index equality
123-
/// [X] [Y] EQUAL
123+
/// `[X] [Y] EQUAL`
124124
IdxEq(IdxExpr, IdxExpr),
125125
}
126126

@@ -720,7 +720,7 @@ impl AssetExpr<CovExtArgs> {
720720
}
721721

722722
/// Returns (self, start_pos) parsed reversed form tokens starting with index end_pos
723-
/// Expression is parsed from tokens[start:end_pos]
723+
/// Expression is parsed from tokens`[start:end_pos]`
724724
pub fn from_tokens(tokens: &[Tk], end_pos: usize) -> Option<(Self, usize)> {
725725
let tks = tokens;
726726
let e = end_pos; // short abbreviations for succinct readable code
@@ -808,7 +808,7 @@ impl ValueExpr<CovExtArgs> {
808808
}
809809

810810
/// Returns (self, start_pos) parsed reversed form tokens starting with index end_pos
811-
/// Expression is parsed from tokens[start:end_pos]
811+
/// Expression is parsed from tokens`[start:end_pos]`
812812
pub fn from_tokens(tokens: &[Tk], end_pos: usize) -> Option<(Self, usize)> {
813813
let tks = tokens;
814814
let e = end_pos; // short abbreviations for succinct readable code
@@ -898,7 +898,7 @@ impl SpkExpr<CovExtArgs> {
898898
}
899899

900900
/// Returns (self, start_pos) parsed reversed form tokens starting with index end_pos
901-
/// Expression is parsed from tokens[start:end_pos]
901+
/// Expression is parsed from tokens`[start:end_pos]`
902902
pub fn from_tokens(tokens: &[Tk], end_pos: usize) -> Option<(Self, usize)> {
903903
let tks = tokens;
904904
let e = end_pos; // short abbreviations for succinct readable code
@@ -1007,7 +1007,7 @@ impl CovOps<CovExtArgs> {
10071007
}
10081008

10091009
/// Returns (self, start_pos) parsed reversed form tokens starting with index end_pos
1010-
/// Expression is parsed from tokens[start:end_pos]
1010+
/// Expression is parsed from tokens`[start:end_pos]`
10111011
pub fn from_tokens(tks: &[Tk]) -> Option<(Self, usize)> {
10121012
let e = tks.len();
10131013
if let Some(&[Tk::Num(i), Tk::CurrInp, Tk::Equal]) = tks.get(e.checked_sub(3)?..e) {

src/extensions/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ pub trait Extension: Clone + Eq + Ord + fmt::Debug + fmt::Display + hash::Hash {
6363
}
6464

6565
/// Create an instance of this object from a Tree with root name and children as
66-
/// Vec<Tree>.
66+
/// `Vec<Tree>`.
6767
// Ideally, we would want a FromTree implementation here, but that is not possible
6868
// as we would need to create a new Tree by removing wrappers from root.
6969
fn from_name_tree(_name: &str, children: &[Tree<'_>]) -> Result<Self, ()>;

src/extensions/outputs_pref.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ use crate::{expression, interpreter, Error, Extension, MiniscriptKey, Satisfier,
3030
/// Even if the witness does not require 7 pushes, the user should push
3131
/// 7 elements with possibly empty values.
3232
///
33-
/// CAT CAT CAT CAT CAT CAT <pref> SWAP CAT /*Now we hashoutputs on stack */
34-
/// HASH256
35-
/// DEPTH <10> SUB PICK EQUALVERIFY
33+
/// `CAT CAT CAT CAT CAT CAT <pref> SWAP CAT` /*Now we hashoutputs on stack */
34+
/// `HASH256`
35+
/// `DEPTH <10> SUB PICK EQUALVERIFY`
3636
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone)]
3737
pub struct LegacyOutputsPref {
3838
/// the version of transaction

src/extensions/param.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ where
220220
type Output;
221221

222222
/// Translates a struct from one generic to another where the translations
223-
/// for Pk are provided by the given [`Translator`].
223+
/// for Pk are provided by the given [`ExtParamTranslator`].
224224
fn translate_ext<T, E>(&self, translator: &mut T) -> Result<Self::Output, E>
225225
where
226226
T: ExtParamTranslator<PArg, QArg, E>;

src/miniscript/limits.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ pub const MAX_SCRIPT_ELEMENT_SIZE: usize = 520;
2424
// https://github.com/bitcoin/bitcoin/blob/42b66a6b814bca130a9ccf0a3f747cf33d628232/src/policy/policy.cpp#L102
2525
pub const MAX_SCRIPTSIG_SIZE: usize = 1650;
2626
/// Maximum Initial witness size allowed
27-
/// https://github.com/bitcoin/bitcoin/blob/283a73d7eaea2907a6f7f800f529a0d6db53d7a6/src/policy/policy.h#L42
27+
/// `<https://github.com/bitcoin/bitcoin/blob/283a73d7eaea2907a6f7f800f529a0d6db53d7a6/src/policy/policy.h#L42>`
2828
pub const MAX_STANDARD_P2WSH_STACK_ITEM_SIZE: usize = 80;
2929
/// Maximum items during stack execution
3030
// This limits also applies for initial stack satisfaction

0 commit comments

Comments
 (0)