pub struct Witness { /* private fields */ }
Expand description
The Witness is the data used to unlock bitcoins since the segwit upgrade
Can be logically seen as an array of byte-arrays Vec<Vec<u8>>
and indeed you can convert from
it Witness::from_vec
and convert into it Witness::to_vec
.
For serialization and deserialization performance it is stored internally as a single Vec
,
saving some allocations.
Implementations
sourceimpl Witness
impl Witness
sourcepub fn to_vec(&self) -> Vec<Vec<u8>>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
pub fn to_vec(&self) -> Vec<Vec<u8>>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
A: Allocator,
Convenience method to create an array of byte-arrays from this witness
sourcepub fn iter(&self) -> Iter<'_>ⓘNotable traits for Iter<'a>impl<'a> Iterator for Iter<'a> type Item = &'a [u8];
pub fn iter(&self) -> Iter<'_>ⓘNotable traits for Iter<'a>impl<'a> Iterator for Iter<'a> type Item = &'a [u8];
Returns a struct implementing Iterator
sourcepub fn serialized_len(&self) -> usize
pub fn serialized_len(&self) -> usize
Returns the bytes required when this Witness is consensus encoded
Trait Implementations
sourceimpl Decodable for Witness
impl Decodable for Witness
sourcefn consensus_decode<D: Read>(d: D) -> Result<Self, Error>
fn consensus_decode<D: Read>(d: D) -> Result<Self, Error>
Decode an object with a well-defined format
sourceimpl Deserialize for Witness
impl Deserialize for Witness
sourceimpl<'de> Deserialize<'de> for Witness
impl<'de> Deserialize<'de> for Witness
sourcefn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl Ord for Witness
impl Ord for Witness
sourceimpl PartialOrd<Witness> for Witness
impl PartialOrd<Witness> for Witness
sourcefn partial_cmp(&self, other: &Witness) -> Option<Ordering>
fn partial_cmp(&self, other: &Witness) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
impl Eq for Witness
impl StructuralEq for Witness
impl StructuralPartialEq for Witness
Auto Trait Implementations
impl RefUnwindSafe for Witness
impl Send for Witness
impl Sync for Witness
impl Unpin for Witness
impl UnwindSafe for Witness
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more