SHARE
TWEET

Untitled

a guest Apr 26th, 2019 74 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. extern crate byteorder;
  2.  
  3. use std::error::Error;
  4.  
  5. // WriteBytesExt is a trait which implements the `write_u64` method on `vec`
  6. use byteorder::{LittleEndian, WriteBytesExt};
  7.  
  8. fn main() -> Result<(), Box<Error>> {
  9.     let x: u64 = 0xdeadbeef;
  10.     let mut buf = Vec::new();
  11.     buf.write_u64::<LittleEndian>(x)?;
  12.    
  13.     for b in buf {
  14.         println!("0x{:x}", b);
  15.     }
  16.    
  17.     Ok(())
  18. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top