Skip to content

Commit

Permalink
Use PyBytes as it is faster than Vec<u8>
Browse files Browse the repository at this point in the history
  • Loading branch information
haixuanTao committed Aug 3, 2022
1 parent f2b3bd5 commit 4ff9a59
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions apis/python/node/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,10 @@ impl Node {
slf
}

pub fn send_output(&self, output_str: String, data: Vec<u8>) -> Result<()> {
pub fn send_output(&self, output_str: String, data: &PyBytes) -> Result<()> {
Ok(self
.tx_output
.blocking_send((output_str, data))
.blocking_send((output_str, data.as_bytes().to_vec()))
.wrap_err("Could not send output")?)
}

Expand Down

0 comments on commit 4ff9a59

Please sign in to comment.