Skip to content

Commit fe3e946

Browse files
authored
Merge pull request #102 from shesek/202111-index-script
2 parents 53d5729 + 899dd5a commit fe3e946

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

src/script.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -512,6 +512,13 @@ impl From<Vec<u8>> for Script {
512512
fn from(v: Vec<u8>) -> Script { Script(v.into_boxed_slice()) }
513513
}
514514

515+
impl ops::Index<usize> for Script {
516+
type Output = u8;
517+
fn index(&self, index: usize) -> &u8 {
518+
&self.0[index]
519+
}
520+
}
521+
515522
impl ops::Index<ops::Range<usize>> for Script {
516523
type Output = [u8];
517524
fn index(&self, index: ops::Range<usize>) -> &[u8] {

0 commit comments

Comments
 (0)