pub fn save(&self, filepath: &str) -> std::io::Result<()> {
        let mut s_board = SavedBoard::new();
        for socket in self.sockets.iter() {
            let saved_chip = socket.borrow().save();
            let mut saved_socket = SavedSocket::new();
            if saved_chip.chip_type != "NULL" {
                saved_socket.set_chip(saved_chip);
            }
            s_board.add_socket(saved_socket);
        }
        for trace in self.traces.iter() {
            s_board.add_trace(trace.borrow().save());
        }

        let file = std::fs::File::create(std::path::Path::new(filepath))?;
        if let Err(e) = ron::ser::to_writer(file, &s_board) {
            Err(std::io::Error::new(
                std::io::ErrorKind::Interrupted,
                format!("{:?}", e),
            ))
        } else {
            Ok(())
        }
    }
/// Save the board to a file in RON format
Save the board to a file in RON format
Save the board to a file in RON format
pub fn save(&self, filepath: &str) -> std::io::Result<()> {
        let mut s_board = SavedBoard::new();
        for socket in self.sockets.iter() {
            let saved_chip = socket.borrow().save();
            let mut saved_socket = SavedSocket::new();
            if saved_chip.chip_type != "NULL" {
                saved_socket.set_chip(saved_chip);
            }
            s_board.add_socket(saved_socket);
        }
        for trace in self.traces.iter() {
            s_board.add_trace(trace.borrow().save());
        }
        let file = std::fs::File::create(std::path::Path::new(filepath))?;
        if let Err(e) = ron::ser::to_writer(file, &s_board) {
            Err(std::io::Error::new(
                std::io::ErrorKind::Interrupted,
                format!("{:?}", e),
            ))
        } else {
            Ok(())
        }
    }
pub fn save ( & self , filepath : & str ) -> std :: io :: Result < ( ) > { let mut s_board = SavedBoard :: new ( ) ; for socket in self . sockets . iter ( ) { let saved_chip = socket . borrow ( ) . save ( ) ; let mut saved_socket = SavedSocket :: new ( ) ; if saved_chip . chip_type != " " { saved_socket . set_chip ( saved_chip ) ; } s_board . add_socket ( saved_socket ) ; } for trace in self . traces . iter ( ) { s_board . add_trace ( trace . borrow ( ) . save ( ) ) ; } let file = std :: fs :: File :: create ( std :: path :: Path :: new ( filepath ) ) ? ; if let Err ( e ) = ron :: ser :: to_writer ( file , & s_board ) { Err ( std :: io :: Error :: new ( std :: io :: ErrorKind :: Interrupted , format ! ( " " e ) , ) ) } else { Ok ( ( ) ) } }
Save the board to a file in RON format
Save the board to a file in RON format
&self
filepath
&str
&self
filepath
&str