/// Write the GPT to a writer. This function will seek automatically in the writer to write the
/// primary header and the backup header at their proper location.
///
/// Returns the backup `GPTHeader` that has been wrote in case of success (or the primary
/// `GPTHeader` if `self` was using a backup header).
///
/// Note that the checksums are re-calculated, thus updating the header.
///
/// # Errors
///
/// The partitions will be checked for consistency before being wrote to disk:
///
/// * the partition GUIDs must be unique,
/// * the partitions must have positive size,
/// * the partitions must not overlap,
/// * the partitions must fit within the disk.
///
/// # Examples
///
/// Basic usage:
/// ```
/// let ss = 512;
/// let data = vec![0; 100 * ss as usize];
/// let mut cur = std::io::Cursor::new(data);
/// let mut gpt = gptman::GPT::new_from(&mut cur, ss as u64, [0xff; 16])
///     .expect("could not make a partition table");
///
/// // actually write:
/// gpt.write_into(&mut cur)
///     .expect("could not write GPT to disk");
/// ```
Write the GPT to a writer. This function will seek automatically in the writer to write the
primary header and the backup header at their proper location.



Note that the checksums are re-calculated, thus updating the header.
Write the GPT to a writer . This function will seek automatically in the writer to write the primary header and the backup header at their proper location . Note that the checksums are re - calculated thus updating the header .
pub fn write_into<W: ?Sized>(&mut self, mut writer: &mut W) -> Result<GPTHeader>
    where
        W: Write + Seek,
    {
        self.check_partition_guids()?;
        self.check_partition_boundaries()?;
        let mut backup = self.header.clone();
        backup.primary_lba = self.header.backup_lba;
        backup.backup_lba = self.header.primary_lba;
        backup.partition_entry_lba = if self.header.partition_entry_lba == 2 {
            self.header.last_usable_lba + 1
        } else {
            2
        };
        self.header
            .write_into(&mut writer, self.sector_size, &self.partitions)?;
        backup.write_into(&mut writer, self.sector_size, &self.partitions)?;
        Ok(backup)
    }
pub fn write_into < W : ? Sized > ( & mut self , mut writer : & mut W ) -> Result < GPTHeader > where W : Write + Seek , { self . check_partition_guids ( ) ? ; self . check_partition_boundaries ( ) ? ; let mut backup = self . header . clone ( ) ; backup . primary_lba = self . header . backup_lba ; backup . backup_lba = self . header . primary_lba ; backup . partition_entry_lba = if self . header . partition_entry_lba == 2 { self . header . last_usable_lba + 1 } else { 2 } ; self . header . write_into ( & mut writer , self . sector_size , & self . partitions ) ? ; backup . write_into ( & mut writer , self . sector_size , & self . partitions ) ? ; Ok ( backup ) }
Write the GPT to a writer.
Write the GPT to a writer .
&mut self
writer
&mut W
errors
The partitions will be checked for consistency before being wrote to disk.

the partition GUIDs must be unique,
the partitions must have positive size,
the partitions must not overlap,
the partitions must fit within the disk.
The partitions will be checked for consistency before being wrote to disk . the partition GUIDs must be unique the partitions must have positive size the partitions must not overlap the partitions must fit within the disk .
examples
Basic usage:
```
let ss = 512;
let data = vec![0; 100 * ss as usize];
let mut cur = std::io::Cursor::new(data);
let mut gpt = gptman::GPT::new_from(&mut cur, ss as u64, [0xff; 16])
.expect("could not make a partition table").

actually write:
gpt.write_into(&mut cur)
.expect("could not write GPT to disk");
```
Basic usage : ` ` ` let ss = 512 ; let data = vec! [ 0 ; 100 * ss as usize ] ; let mut cur = std :: io :: Cursor :: new ( data ) ; let mut gpt = gptman :: GPT :: new_from ( &mut cur ss as u64 [ 0xff ; 16 ] ) . expect ( " could not make a partition table " ) . actually write : gpt . write_into ( &mut cur ) . expect ( " could not write GPT to disk " ) ; ` ` `