Implement Default for Script

Add Default implementation for Script that returns an empty script.

ScriptBuf already has #[derive(Default)] in the code so it's already handled
This commit is contained in:
jrakibi 2025-02-13 03:00:40 +05:30
parent 58bb2b1200
commit ab2f709181
1 changed files with 5 additions and 0 deletions

View File

@ -56,6 +56,11 @@ use crate::prelude::{Box, ToOwned, Vec};
#[repr(transparent)] #[repr(transparent)]
pub struct Script(pub(in crate::script) [u8]); pub struct Script(pub(in crate::script) [u8]);
impl Default for &Script {
#[inline]
fn default() -> Self { Script::new() }
}
impl ToOwned for Script { impl ToOwned for Script {
type Owned = ScriptBuf; type Owned = ScriptBuf;