Struct bc::ScriptBytes 
source · pub struct ScriptBytes(/* private fields */);Implementations§
source§impl ScriptBytes
 
impl ScriptBytes
sourcepub fn from_unsafe(script_bytes: Vec<u8>) -> Self
 
pub fn from_unsafe(script_bytes: Vec<u8>) -> Self
Constructs script object assuming the script length is less than 4GB. Panics otherwise.
sourcepub fn push_slice(&mut self, data: &[u8])
 
pub fn push_slice(&mut self, data: &[u8])
Adds instructions to push some arbitrary data onto the stack.
§Panics
The method panics if data length is greater or equal to
0x100000000.
sourcepub fn len_for_slice(len: usize) -> usize
 
pub fn len_for_slice(len: usize) -> usize
Computes the sum of len and the length of an appropriate push
opcode.
pub fn len_var_int(&self) -> VarInt
pub fn into_vec(self) -> Vec<u8> ⓘ
Methods from Deref<Target = VarIntBytes>§
sourcepub fn iter_mut(&'c mut self) -> <&'c mut C as IntoIterator>::IntoIter
 
pub fn iter_mut(&'c mut self) -> <&'c mut C as IntoIterator>::IntoIter
Returns an iterator that allows modifying each value.
The iterator yields all items from start to end.
sourcepub fn keyed_values_mut(&'c mut self) -> <&'c mut C as IntoIterator>::IntoIter
 
pub fn keyed_values_mut(&'c mut self) -> <&'c mut C as IntoIterator>::IntoIter
Returns an iterator that allows modifying each value for each key.
sourcepub fn push(&mut self, elem: <C as Collection>::Item) -> Result<(), Error>
 
pub fn push(&mut self, elem: <C as Collection>::Item) -> Result<(), Error>
Attempts to add a single element to the confined collection. Fails if the number of elements in the collection already maximal.
sourcepub fn extend<T>(&mut self, iter: T) -> Result<(), Error>
 
pub fn extend<T>(&mut self, iter: T) -> Result<(), Error>
Attempts to add all elements from an iterator to the confined collection. Fails if the number of elements in the collection already maximal.
sourcepub fn len_u8(&self) -> u8
 
pub fn len_u8(&self) -> u8
Returns number of elements in the confined collection as u8. The
confinement guarantees that the collection length can’t exceed
u8::MAX.
sourcepub fn len_u16(&self) -> u16
 
pub fn len_u16(&self) -> u16
Returns number of elements in the confined collection as u16. The
confinement guarantees that the collection length can’t exceed
u16::MAX.
sourcepub fn len_u24(&self) -> u24
 
pub fn len_u24(&self) -> u24
Returns number of elements in the confined collection as u24. The
confinement guarantees that the collection length can’t exceed
u24::MAX.
sourcepub fn len_u32(&self) -> u32
 
pub fn len_u32(&self) -> u32
Returns number of elements in the confined collection as u32. The
confinement guarantees that the collection length can’t exceed
u32::MAX.
sourcepub fn get_mut(
    &mut self,
    key: &<C as KeyedCollection>::Key
) -> Option<&mut <C as KeyedCollection>::Value>
 
pub fn get_mut( &mut self, key: &<C as KeyedCollection>::Key ) -> Option<&mut <C as KeyedCollection>::Value>
Gets mutable reference to an element of the collection.
sourcepub fn insert(
    &mut self,
    key: <C as KeyedCollection>::Key,
    value: <C as KeyedCollection>::Value
) -> Result<Option<<C as KeyedCollection>::Value>, Error>
 
pub fn insert( &mut self, key: <C as KeyedCollection>::Key, value: <C as KeyedCollection>::Value ) -> Result<Option<<C as KeyedCollection>::Value>, Error>
Inserts a new value into the confined collection under a given key. Fails if the collection already contains maximum number of elements allowed by the confinement.
sourcepub fn pop(&mut self) -> Option<char>
 
pub fn pop(&mut self) -> Option<char>
Removes the last character from a string and returns it, or None if
it is empty.
sourcepub fn remove(&mut self, index: usize) -> Result<char, Error>
 
pub fn remove(&mut self, index: usize) -> Result<char, Error>
Removes a single character from the confined string, unless the string doesn’t shorten more than the confinement requirement. Errors otherwise.
sourcepub fn pop(&mut self) -> Option<AsciiChar>
 
pub fn pop(&mut self) -> Option<AsciiChar>
Removes the last character from a string and returns it, or None if
it is empty.
sourcepub fn remove(&mut self, index: usize) -> Result<AsciiChar, Error>
 
pub fn remove(&mut self, index: usize) -> Result<AsciiChar, Error>
Removes a single character from the confined string, unless the string doesn’t shorten more than the confinement requirement. Errors otherwise.
sourcepub fn get_mut<I>(
    &mut self,
    index: I
) -> Option<&mut <I as SliceIndex<[T]>>::Output>where
    I: SliceIndex<[T]>,
 
pub fn get_mut<I>(
    &mut self,
    index: I
) -> Option<&mut <I as SliceIndex<[T]>>::Output>where
    I: SliceIndex<[T]>,
Gets the mutable element of a vector
sourcepub fn pop(&mut self) -> Option<T>
 
pub fn pop(&mut self) -> Option<T>
Removes the last element from a vector and returns it, or None if it
is empty.
sourcepub fn remove(&mut self, index: usize) -> Result<T, Error>
 
pub fn remove(&mut self, index: usize) -> Result<T, Error>
Removes an element from the vector at a given index. Errors if the index exceeds the number of elements in the vector, of if the new vector length will be less than the confinement requirement. Returns the removed element otherwise.
sourcepub fn iter(&self) -> Iter<'_, T>
 
pub fn iter(&self) -> Iter<'_, T>
Returns an iterator over the slice.
The iterator yields all items from start to end.
sourcepub fn pop_front(&mut self) -> Option<T>
 
pub fn pop_front(&mut self) -> Option<T>
Removes the first element and returns it, or None if the deque is
empty.
sourcepub fn pop_back(&mut self) -> Option<T>
 
pub fn pop_back(&mut self) -> Option<T>
Removes the last element and returns it, or None if the deque is
empty.
sourcepub fn push_from(&mut self, elem: T) -> Result<(), Error>
 
pub fn push_from(&mut self, elem: T) -> Result<(), Error>
Prepends an element to the deque. Errors if the new collection length will not fit the confinement requirements.
sourcepub fn push_back(&mut self, elem: T) -> Result<(), Error>
 
pub fn push_back(&mut self, elem: T) -> Result<(), Error>
Appends an element to the deque. Errors if the new collection length will not fit the confinement requirements.
sourcepub fn remove(&mut self, index: usize) -> Result<T, Error>
 
pub fn remove(&mut self, index: usize) -> Result<T, Error>
Removes an element from the deque at a given index. Errors if the index exceeds the number of elements in the deque, of if the new deque length will be less than the confinement requirement. Returns the removed element otherwise.
sourcepub fn remove(&mut self, elem: &T) -> Result<bool, Error>
 Available on crate feature std only.
pub fn remove(&mut self, elem: &T) -> Result<bool, Error>
std only.Removes an element from the set. Errors if the index exceeds the number of elements in the set, of if the new collection length will be less than the confinement requirement. Returns if the element was present in the set.
sourcepub fn take(&mut self, elem: &T) -> Result<Option<T>, Error>
 Available on crate feature std only.
pub fn take(&mut self, elem: &T) -> Result<Option<T>, Error>
std only.Removes an element from the set. Errors if the index exceeds the number of elements in the set, of if the new collection length will be less than the confinement requirement. Returns the removed element otherwise.
sourcepub fn remove(&mut self, elem: &T) -> Result<bool, Error>
 
pub fn remove(&mut self, elem: &T) -> Result<bool, Error>
Removes an element from the set. Errors if the index exceeds the number of elements in the set, of if the new collection length will be less than the confinement requirement. Returns if the element was present in the set.
sourcepub fn take(&mut self, elem: &T) -> Result<Option<T>, Error>
 
pub fn take(&mut self, elem: &T) -> Result<Option<T>, Error>
Removes an element from the set. Errors if the index exceeds the number of elements in the set, of if the new collection length will be less than the confinement requirement. Returns the removed element otherwise.
sourcepub fn remove(&mut self, key: &K) -> Result<Option<V>, Error>
 Available on crate feature std only.
pub fn remove(&mut self, key: &K) -> Result<Option<V>, Error>
std only.Removes an element from the map. Errors if the index exceeds the number of elements in the map, of if the new collection length will be less than the confinement requirement. Returns the removed value otherwise.
Trait Implementations§
source§impl AsMut<<ScriptBytes as Wrapper>::Inner> for ScriptBytes
 
impl AsMut<<ScriptBytes as Wrapper>::Inner> for ScriptBytes
source§impl AsMut<[u8]> for ScriptBytes
 
impl AsMut<[u8]> for ScriptBytes
source§impl AsRef<[u8]> for ScriptBytes
 
impl AsRef<[u8]> for ScriptBytes
source§impl AsRef<Confined<Vec<u8>, 0, U32>> for ScriptBytes
 
impl AsRef<Confined<Vec<u8>, 0, U32>> for ScriptBytes
source§fn as_ref(&self) -> &VarIntBytes
 
fn as_ref(&self) -> &VarIntBytes
source§impl AsRef<ScriptBytes> for RedeemScript
 
impl AsRef<ScriptBytes> for RedeemScript
source§fn as_ref(&self) -> &ScriptBytes
 
fn as_ref(&self) -> &ScriptBytes
source§impl AsRef<ScriptBytes> for ScriptPubkey
 
impl AsRef<ScriptBytes> for ScriptPubkey
source§fn as_ref(&self) -> &ScriptBytes
 
fn as_ref(&self) -> &ScriptBytes
source§impl AsRef<ScriptBytes> for SigScript
 
impl AsRef<ScriptBytes> for SigScript
source§fn as_ref(&self) -> &ScriptBytes
 
fn as_ref(&self) -> &ScriptBytes
source§impl AsRef<ScriptBytes> for TapScript
 
impl AsRef<ScriptBytes> for TapScript
source§fn as_ref(&self) -> &ScriptBytes
 
fn as_ref(&self) -> &ScriptBytes
source§impl AsRef<ScriptBytes> for WitnessScript
 
impl AsRef<ScriptBytes> for WitnessScript
source§fn as_ref(&self) -> &ScriptBytes
 
fn as_ref(&self) -> &ScriptBytes
source§impl Borrow<Confined<Vec<u8>, 0, U32>> for ScriptBytes
 
impl Borrow<Confined<Vec<u8>, 0, U32>> for ScriptBytes
source§fn borrow(&self) -> &VarIntBytes
 
fn borrow(&self) -> &VarIntBytes
source§impl Borrow<ScriptBytes> for RedeemScript
 
impl Borrow<ScriptBytes> for RedeemScript
source§fn borrow(&self) -> &ScriptBytes
 
fn borrow(&self) -> &ScriptBytes
source§impl Borrow<ScriptBytes> for ScriptPubkey
 
impl Borrow<ScriptBytes> for ScriptPubkey
source§fn borrow(&self) -> &ScriptBytes
 
fn borrow(&self) -> &ScriptBytes
source§impl Borrow<ScriptBytes> for SigScript
 
impl Borrow<ScriptBytes> for SigScript
source§fn borrow(&self) -> &ScriptBytes
 
fn borrow(&self) -> &ScriptBytes
source§impl Borrow<ScriptBytes> for TapScript
 
impl Borrow<ScriptBytes> for TapScript
source§fn borrow(&self) -> &ScriptBytes
 
fn borrow(&self) -> &ScriptBytes
source§impl Borrow<ScriptBytes> for WitnessScript
 
impl Borrow<ScriptBytes> for WitnessScript
source§fn borrow(&self) -> &ScriptBytes
 
fn borrow(&self) -> &ScriptBytes
source§impl BorrowMut<<ScriptBytes as Wrapper>::Inner> for ScriptBytes
 
impl BorrowMut<<ScriptBytes as Wrapper>::Inner> for ScriptBytes
source§impl Clone for ScriptBytes
 
impl Clone for ScriptBytes
source§fn clone(&self) -> ScriptBytes
 
fn clone(&self) -> ScriptBytes
1.0.0 · source§fn clone_from(&mut self, source: &Self)
 
fn clone_from(&mut self, source: &Self)
source. Read moresource§impl ConsensusDecode for ScriptBytes
 
impl ConsensusDecode for ScriptBytes
fn consensus_decode( reader: &mut impl Read ) -> Result<Self, ConsensusDecodeError>
fn consensus_deserialize( bytes: impl AsRef<[u8]> ) -> Result<Self, ConsensusDecodeError>
source§impl ConsensusEncode for ScriptBytes
 
impl ConsensusEncode for ScriptBytes
source§impl Debug for ScriptBytes
 
impl Debug for ScriptBytes
source§impl Default for ScriptBytes
 
impl Default for ScriptBytes
source§fn default() -> ScriptBytes
 
fn default() -> ScriptBytes
source§impl Deref for ScriptBytes
 
impl Deref for ScriptBytes
source§impl DerefMut for ScriptBytes
 
impl DerefMut for ScriptBytes
source§impl<'de> Deserialize<'de> for ScriptBytes
Available on crate feature serde only. 
impl<'de> Deserialize<'de> for ScriptBytes
serde only.source§fn 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>,
source§impl From<Confined<Vec<u8>, 0, U32>> for ScriptBytes
 
impl From<Confined<Vec<u8>, 0, U32>> for ScriptBytes
source§fn from(v: VarIntBytes) -> Self
 
fn from(v: VarIntBytes) -> Self
source§impl From<RedeemScript> for ScriptBytes
 
impl From<RedeemScript> for ScriptBytes
source§fn from(wrapped: RedeemScript) -> Self
 
fn from(wrapped: RedeemScript) -> Self
source§impl From<ScriptBytes> for VarIntBytes
 
impl From<ScriptBytes> for VarIntBytes
source§fn from(wrapped: ScriptBytes) -> Self
 
fn from(wrapped: ScriptBytes) -> Self
source§impl From<ScriptBytes> for RedeemScript
 
impl From<ScriptBytes> for RedeemScript
source§fn from(v: ScriptBytes) -> Self
 
fn from(v: ScriptBytes) -> Self
source§impl From<ScriptBytes> for ScriptPubkey
 
impl From<ScriptBytes> for ScriptPubkey
source§fn from(v: ScriptBytes) -> Self
 
fn from(v: ScriptBytes) -> Self
source§impl From<ScriptBytes> for SigScript
 
impl From<ScriptBytes> for SigScript
source§fn from(v: ScriptBytes) -> Self
 
fn from(v: ScriptBytes) -> Self
source§impl From<ScriptBytes> for TapScript
 
impl From<ScriptBytes> for TapScript
source§fn from(v: ScriptBytes) -> Self
 
fn from(v: ScriptBytes) -> Self
source§impl From<ScriptBytes> for WitnessScript
 
impl From<ScriptBytes> for WitnessScript
source§fn from(v: ScriptBytes) -> Self
 
fn from(v: ScriptBytes) -> Self
source§impl From<ScriptPubkey> for ScriptBytes
 
impl From<ScriptPubkey> for ScriptBytes
source§fn from(wrapped: ScriptPubkey) -> Self
 
fn from(wrapped: ScriptPubkey) -> Self
source§impl From<SigScript> for ScriptBytes
 
impl From<SigScript> for ScriptBytes
source§impl From<TapScript> for ScriptBytes
 
impl From<TapScript> for ScriptBytes
source§impl From<WitnessScript> for ScriptBytes
 
impl From<WitnessScript> for ScriptBytes
source§fn from(wrapped: WitnessScript) -> Self
 
fn from(wrapped: WitnessScript) -> Self
source§impl FromHex for ScriptBytes
 
impl FromHex for ScriptBytes
source§impl Hash for ScriptBytes
 
impl Hash for ScriptBytes
source§impl LowerHex for ScriptBytes
 
impl LowerHex for ScriptBytes
source§impl Ord for ScriptBytes
 
impl Ord for ScriptBytes
source§fn cmp(&self, other: &ScriptBytes) -> Ordering
 
fn cmp(&self, other: &ScriptBytes) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
    Self: Sized,
 
fn max(self, other: Self) -> Selfwhere
    Self: Sized,
source§impl PartialEq for ScriptBytes
 
impl PartialEq for ScriptBytes
source§fn eq(&self, other: &ScriptBytes) -> bool
 
fn eq(&self, other: &ScriptBytes) -> bool
self and other values to be equal, and is used
by ==.source§impl PartialOrd for ScriptBytes
 
impl PartialOrd for ScriptBytes
source§fn partial_cmp(&self, other: &ScriptBytes) -> Option<Ordering>
 
fn partial_cmp(&self, other: &ScriptBytes) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
 
fn le(&self, other: &Rhs) -> bool
self and other) and is used by the <=
operator. Read moresource§impl Serialize for ScriptBytes
Available on crate feature serde only. 
impl Serialize for ScriptBytes
serde only.source§impl StrictDecode for ScriptBytes
 
impl StrictDecode for ScriptBytes
fn strict_decode(reader: &mut impl TypedRead) -> Result<Self, DecodeError>
fn strict_read(reader: impl ReadRaw) -> Result<Self, DecodeError>
source§impl StrictEncode for ScriptBytes
 
impl StrictEncode for ScriptBytes
fn strict_encode<W: TypedWrite>(&self, writer: W) -> Result<W>
fn strict_write(&self, writer: impl WriteRaw) -> Result<(), Error>
source§impl StrictTuple for ScriptBytes
 
impl StrictTuple for ScriptBytes
const FIELD_COUNT: u8 = 1u8
fn strict_check_fields()
fn strict_type_info() -> TypeInfo<Self>
source§impl StrictType for ScriptBytes
 
impl StrictType for ScriptBytes
const STRICT_LIB_NAME: &'static str = LIB_NAME_BITCOIN
fn strict_name() -> Option<TypeName>
source§impl UpperHex for ScriptBytes
 
impl UpperHex for ScriptBytes
source§impl Wrapper for ScriptBytes
 
impl Wrapper for ScriptBytes
source§impl WrapperMut for ScriptBytes
 
impl WrapperMut for ScriptBytes
source§fn as_inner_mut(&mut self) -> &mut <Self as Wrapper>::Inner
 
fn as_inner_mut(&mut self) -> &mut <Self as Wrapper>::Inner
impl Eq for ScriptBytes
impl StrictProduct for ScriptBytes
impl StructuralPartialEq for ScriptBytes
Auto Trait Implementations§
impl Freeze for ScriptBytes
impl RefUnwindSafe for ScriptBytes
impl Send for ScriptBytes
impl Sync for ScriptBytes
impl Unpin for ScriptBytes
impl UnwindSafe for ScriptBytes
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
    T: ?Sized,
 
impl<T> BorrowMut<T> for Twhere
    T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
 
fn borrow_mut(&mut self) -> &mut T
source§impl<Q, K> Comparable<K> for Q
 
impl<Q, K> Comparable<K> for Q
source§impl<Q, K> Equivalent<K> for Q
 
impl<Q, K> Equivalent<K> for Q
source§impl<Q, K> Equivalent<K> for Q
 
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
 
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.