From 40db2f5ed602183f404f5ff43bd90fe78a93ffc0 Mon Sep 17 00:00:00 2001 From: "Tobin C. Harding" Date: Thu, 24 Aug 2023 17:27:35 +1000 Subject: [PATCH] witness_version: Remove rustdocs from TryFrom imlps These docs do not add much value. Done in preparation for splitting up the `witness_version::Error` type into specific errors. --- .../src/blockdata/script/witness_version.rs | 40 ------------------- 1 file changed, 40 deletions(-) diff --git a/bitcoin/src/blockdata/script/witness_version.rs b/bitcoin/src/blockdata/script/witness_version.rs index 50dccf8e..dd102fbd 100644 --- a/bitcoin/src/blockdata/script/witness_version.rs +++ b/bitcoin/src/blockdata/script/witness_version.rs @@ -98,31 +98,12 @@ impl FromStr for WitnessVersion { impl TryFrom for WitnessVersion { type Error = Error; - /// Converts 5-bit unsigned integer value matching single symbol from Bech32(m) address encoding - /// ([`bech32::u5`]) into [`WitnessVersion`] variant. - /// - /// # Returns - /// - /// Version of the Witness program. - /// - /// # Errors - /// - /// If the integer does not correspond to any witness version, errors with [`Error::Invalid`]. fn try_from(value: bech32::u5) -> Result { Self::try_from(value.to_u8()) } } impl TryFrom for WitnessVersion { type Error = Error; - /// Converts an 8-bit unsigned integer value into [`WitnessVersion`] variant. - /// - /// # Returns - /// - /// Version of the Witness program. - /// - /// # Errors - /// - /// If the integer does not correspond to any witness version, errors with [`Error::Invalid`]. fn try_from(no: u8) -> Result { use WitnessVersion::*; @@ -152,16 +133,6 @@ impl TryFrom for WitnessVersion { impl TryFrom for WitnessVersion { type Error = Error; - /// Converts bitcoin script opcode into [`WitnessVersion`] variant. - /// - /// # Returns - /// - /// Version of the Witness program (for opcodes in range of `OP_0`..`OP_16`). - /// - /// # Errors - /// - /// If the opcode does not correspond to any witness version, errors with - /// [`Error::Malformed`]. fn try_from(opcode: Opcode) -> Result { match opcode.to_u8() { 0 => Ok(WitnessVersion::V0), @@ -175,17 +146,6 @@ impl TryFrom for WitnessVersion { impl<'a> TryFrom> for WitnessVersion { type Error = Error; - /// Converts bitcoin script [`Instruction`] (parsed opcode) into [`WitnessVersion`] variant. - /// - /// # Returns - /// - /// Version of the Witness program for [`Instruction::Op`] and [`Instruction::PushBytes`] with - /// byte value within `1..=16` range. - /// - /// # Errors - /// - /// If the opcode does not correspond to any witness version, errors with - /// [`Error::Malformed`] for the rest of opcodes. fn try_from(instruction: Instruction) -> Result { match instruction { Instruction::Op(op) => WitnessVersion::try_from(op),