pub fn write(&self) -> std::io::Result<()> {
        let mut file = BufWriter::new(File::create(format!("{}.data", self.name))?);
        self.cred.write(file.by_ref())?;
        file.write_all(&self.private_key_input)?;
        match &self.cred_witness {
            None => file.write_all(&[0])?,
            Some(witness) => {
                file.write_all(&[1])?;
                witness.write(file.by_ref())?;
            }
        }
        file.write_all(&u64_array_to_u8_vector(&[self.notes.len() as u64]))?;
        for (note, witness) in self.notes.iter().zip(self.note_witnesses.iter()) {
            note.write(file.by_ref())?;
            witness.write(file.by_ref())?;
        }
        match &self.memory {
            None => file.write_all(&[0])?,
            Some(memory) => {
                file.write_all(&[1])?;
                memory.write(file.by_ref())?;
            }
        };
        match &self.memory_witness {
            None => file.write_all(&[0])?,
            Some(memory_witness) => {
                file.write_all(&[1])?;
                memory_witness.write(file.by_ref())?;
            }
        }
        file.write_all(&u64_array_to_u8_vector(&[self.ceil_memories.len() as u64]))?;
        for (memory, witness) in self
            .ceil_memories
            .iter()
            .zip(self.ceil_memory_witnesses.iter())
        {
            memory.write(file.by_ref())?;
            witness.write(file.by_ref())?;
        }
        file.flush()?;
        Ok(())
    }
/// Write the user's data to the user's .data file, replacing the old file.
Write the user's data to the user's .data file, replacing the old file.
Write the user ' s data to the user ' s . data file replacing the old file .
pub fn write(&self) -> std::io::Result<()> {
        let mut file = BufWriter::new(File::create(format!("{}.data", self.name))?);
        self.cred.write(file.by_ref())?;
        file.write_all(&self.private_key_input)?;
        match &self.cred_witness {
            None => file.write_all(&[0])?,
            Some(witness) => {
                file.write_all(&[1])?;
                witness.write(file.by_ref())?;
            }
        }
        file.write_all(&u64_array_to_u8_vector(&[self.notes.len() as u64]))?;
        for (note, witness) in self.notes.iter().zip(self.note_witnesses.iter()) {
            note.write(file.by_ref())?;
            witness.write(file.by_ref())?;
        }
        match &self.memory {
            None => file.write_all(&[0])?,
            Some(memory) => {
                file.write_all(&[1])?;
                memory.write(file.by_ref())?;
            }
        };
        match &self.memory_witness {
            None => file.write_all(&[0])?,
            Some(memory_witness) => {
                file.write_all(&[1])?;
                memory_witness.write(file.by_ref())?;
            }
        }
        file.write_all(&u64_array_to_u8_vector(&[self.ceil_memories.len() as u64]))?;
        for (memory, witness) in self
            .ceil_memories
            .iter()
            .zip(self.ceil_memory_witnesses.iter())
        {
            memory.write(file.by_ref())?;
            witness.write(file.by_ref())?;
        }
        file.flush()?;
        Ok(())
    }
pub fn write ( & self ) -> std :: io :: Result < ( ) > { let mut file = BufWriter :: new ( File :: create ( format ! ( " " self name ) ) ? ) ; self . cred . write ( file . by_ref ( ) ) ? ; file . write_all ( & self . private_key_input ) ? ; match & self . cred_witness { None => file . write_all ( & [ 0 ] ) ? , Some ( witness ) => { file . write_all ( & [ 1 ] ) ? ; witness . write ( file . by_ref ( ) ) ? ; } } file . write_all ( & u64_array_to_u8_vector ( & [ self . notes . len ( ) as u64 ] ) ) ? ; for ( note , witness ) in self . notes . iter ( ) . zip ( self . note_witnesses . iter ( ) ) { note . write ( file . by_ref ( ) ) ? ; witness . write ( file . by_ref ( ) ) ? ; } match & self . memory { None => file . write_all ( & [ 0 ] ) ? , Some ( memory ) => { file . write_all ( & [ 1 ] ) ? ; memory . write ( file . by_ref ( ) ) ? ; } } ; match & self . memory_witness { None => file . write_all ( & [ 0 ] ) ? , Some ( memory_witness ) => { file . write_all ( & [ 1 ] ) ? ; memory_witness . write ( file . by_ref ( ) ) ? ; } } file . write_all ( & u64_array_to_u8_vector ( & [ self . ceil_memories . len ( ) as u64 ] ) ) ? ; for ( memory , witness ) in self . ceil_memories . iter ( ) . zip ( self . ceil_memory_witnesses . iter ( ) ) { memory . write ( file . by_ref ( ) ) ? ; witness . write ( file . by_ref ( ) ) ? ; } file . flush ( ) ? ; Ok ( ( ) ) }
Write the user's data to the user's .data file, replacing the old file.
Write the user ' s data to the user ' s . data file replacing the old file .
&self
&self