pub fn serialise(
        &mut self, chunk: &Chunk, file: &mut std::fs::File,
    ) -> bool {
        let encoded_res = bincode::serialize(&chunk);
        match encoded_res {
            Ok(encoded) => {
                let res = file.write_all(&encoded);
                match res {
                    Ok(_) => {
                        return true;
                    }
                    Err(e) => {
                        eprintln!("unable to write compiled file: {}", e);
                        return false;
                    }
                }
            }
            Err(e) => {
                eprintln!("unable to serialise compiled file: {}", e);
                return false;
            }
        }
    }
/// Takes a chunk and a file object as its arguments.  Serialises
/// the chunk to the file.
Takes a chunk and a file object as its arguments.  Serialises
the chunk to the file.
Takes a chunk and a file object as its arguments . Serialises the chunk to the file .
pub fn serialise(
        &mut self, chunk: &Chunk, file: &mut std::fs::File,
    ) -> bool {
        let encoded_res = bincode::serialize(&chunk);
        match encoded_res {
            Ok(encoded) => {
                let res = file.write_all(&encoded);
                match res {
                    Ok(_) => {
                        return true;
                    }
                    Err(e) => {
                        eprintln!("unable to write compiled file: {}", e);
                        return false;
                    }
                }
            }
            Err(e) => {
                eprintln!("unable to serialise compiled file: {}", e);
                return false;
            }
        }
    }
pub fn serialise ( & mut self , chunk : & Chunk , file : & mut std :: fs :: File , ) -> bool { let encoded_res = bincode :: serialize ( & chunk ) ; match encoded_res { Ok ( encoded ) => { let res = file . write_all ( & encoded ) ; match res { Ok ( _ ) => { return true ; } Err ( e ) => { eprintln ! ( " " e ) ; return false ; } } } Err ( e ) => { eprintln ! ( " " e ) ; return false ; } } }
Takes a chunk and a file object as its arguments.
Takes a chunk and a file object as its arguments .
&mut self
chunk
&Chunk
file
&mut std::fs::File