/// Takes bitcoin Script value and returns either corresponding version of
/// the Witness program (for opcodes in range of `OP_0`..`OP_16`) or
/// [WitnessVersionError::IncorrectOpcode] error for the rest of opcodes
Takes bitcoin Script value and returns either corresponding version of
the Witness program (for opcodes in range of `OP_0`..`OP_16`) or
[WitnessVersionError::IncorrectOpcode] error for the rest of opcodes
Takes bitcoin Script value and returns either corresponding version of the Witness program ( for opcodes in range of ` OP_0 ` .. ` OP_16 ` ) or [ WitnessVersionError :: IncorrectOpcode ] error for the rest of opcodes
fn try_from(value: u8) -> Result<Self, Self::Error> {
        use WitnessVersion::*;
        Ok(match value {
            0 => V0,
            1 => V1,
            2 => V2,
            3 => V3,
            4 => V4,
            5 => V5,
            6 => V6,
            7 => V7,
            8 => V8,
            9 => V9,
            10 => V10,
            11 => V11,
            12 => V12,
            13 => V13,
            14 => V14,
            15 => V15,
            16 => V16,
            _ => return Err(WitnessVersionError::IncorrectOpcode),
        })
    }
fn try_from ( value : u8 ) -> Result < Self , Self :: Error > { use WitnessVersion :: * ; Ok ( match value { 0 => V0 , 1 => V1 , 2 => V2 , 3 => V3 , 4 => V4 , 5 => V5 , 6 => V6 , 7 => V7 , 8 => V8 , 9 => V9 , 10 => V10 , 11 => V11 , 12 => V12 , 13 => V13 , 14 => V14 , 15 => V15 , 16 => V16 , _ => return Err ( WitnessVersionError :: IncorrectOpcode ) , } ) }
Takes bitcoin Script value and returns either corresponding version of
the Witness program (for opcodes in range of `OP_0`..`OP_16`) or
[WitnessVersionError::IncorrectOpcode] error for the rest of opcodes
Takes bitcoin Script value and returns either corresponding version of the Witness program ( for opcodes in range of ` OP_0 ` .. ` OP_16 ` ) or [ WitnessVersionError :: IncorrectOpcode ] error for the rest of opcodes
value
u8