Skip to content

Commit

Permalink
Merge rust-bitcoin#4043: Implement Default for Script
Browse files Browse the repository at this point in the history
ab2f709 Implement Default for Script (jrakibi)

Pull request description:

  This PR implements Default for `Script` to return an empty script.

  *Note: ScriptBuf already has `#[derive(Default)]` in the code so it's already handled*
  Resolves rust-bitcoin#3735

ACKs for top commit:
  tcharding:
    ACK ab2f709
  Kixunil:
    ACK ab2f709
  apoelstra:
    ACK ab2f709; successfully ran local tests; neat!

Tree-SHA512: c06ba98d9bf8568e323ef9082a7f06756586360d6bef2b93721db7f6e28a777852e494c86319c97b0fd5444a0010d6c679625753534c0e1c8116e452ce8fa9cc
  • Loading branch information
apoelstra committed Feb 15, 2025
2 parents 007f4d3 + ab2f709 commit 0a19d01
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions primitives/src/script/borrowed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,11 @@ use crate::prelude::{Box, ToOwned, Vec};
#[repr(transparent)]
pub struct Script(pub(in crate::script) [u8]);

impl Default for &Script {
#[inline]
fn default() -> Self { Script::new() }
}

impl ToOwned for Script {
type Owned = ScriptBuf;

Expand Down

0 comments on commit 0a19d01

Please sign in to comment.