Skip to content

Commit

Permalink
Align with previosu code
Browse files Browse the repository at this point in the history
  • Loading branch information
LaurenzV committed Oct 27, 2024
1 parent 577bdbb commit 81c9a9b
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/functions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ pub enum PostScriptOp<'a> {
Roll,
}

impl PostScriptOp<'_> {
impl<'a> PostScriptOp<'a> {
/// Encode a slice of operations into a byte stream.
pub fn encode(ops: &[Self]) -> Vec<u8> {
let mut buf = Vec::new();
Expand All @@ -357,18 +357,18 @@ impl PostScriptOp<'_> {
}

fn write(&self, buf: &mut Vec<u8>) {
match self {
Self::Real(r) => buf.push_decimal(*r),
Self::Integer(i) => buf.push_val(*i),
match *self {
Self::Real(r) => buf.push_decimal(r),
Self::Integer(i) => buf.push_val(i),
Self::If(ops) => {
Self::write_slice(&ops, buf);
buf.push(b' ');
buf.extend(self.operator());
}
Self::IfElse(ops1, ops2) => {
Self::write_slice(&ops1, buf);
Self::write_slice(ops1, buf);
buf.push(b' ');
Self::write_slice(&ops2, buf);
Self::write_slice(ops2, buf);
buf.push(b' ');
buf.extend(self.operator());
}
Expand Down

0 comments on commit 81c9a9b

Please sign in to comment.