pub fn from_slice(slice: &[u8]) -> Result<GPTHeader, LabelError> {
        let mut reader = Cursor::new(slice);
        let mut gpt: GPTHeader =
            deserialize_from(&mut reader).context(DeserializeError {})?;

        if gpt.header_size != 92 {
            return Err(LabelError::GptHeaderSize {
                actual_size: gpt.header_size,
                expected_size: 92,
            });
        }

        if gpt.signature != [0x45, 0x46, 0x49, 0x20, 0x50, 0x41, 0x52, 0x54]
            || gpt.revision != [0x00, 0x00, 0x01, 0x00]
        {
            return Err(LabelError::GptSignature {});
        }

        let checksum = gpt.self_checksum;

        if gpt.checksum() != checksum {
            return Err(LabelError::GptChecksum {});
        }

        Ok(gpt)
    }
/// converts a slice into a gpt header and verifies the validity of the data
converts a slice into a gpt header and verifies the validity of the data
converts a slice into a gpt header and verifies the validity of the data
pub fn from_slice(slice: &[u8]) -> Result<GPTHeader, LabelError> {
        let mut reader = Cursor::new(slice);
        let mut gpt: GPTHeader =
            deserialize_from(&mut reader).context(DeserializeError {})?;
        if gpt.header_size != 92 {
            return Err(LabelError::GptHeaderSize {
                actual_size: gpt.header_size,
                expected_size: 92,
            });
        }
        if gpt.signature != [0x45, 0x46, 0x49, 0x20, 0x50, 0x41, 0x52, 0x54]
            || gpt.revision != [0x00, 0x00, 0x01, 0x00]
        {
            return Err(LabelError::GptSignature {});
        }
        let checksum = gpt.self_checksum;
        if gpt.checksum() != checksum {
            return Err(LabelError::GptChecksum {});
        }
        Ok(gpt)
    }
pub fn from_slice ( slice : & [ u8 ] ) -> Result < GPTHeader , LabelError > { let mut reader = Cursor :: new ( slice ) ; let mut gpt : GPTHeader = deserialize_from ( & mut reader ) . context ( DeserializeError { } ) ? ; if gpt . header_size != 92 { return Err ( LabelError :: GptHeaderSize { actual_size : gpt . header_size , expected_size : 92 , } ) ; } if gpt . signature != [ 0x45 , 0x46 , 0x49 , 0x20 , 0x50 , 0x41 , 0x52 , 0x54 ] || gpt . revision != [ 0x00 , 0x00 , 0x01 , 0x00 ] { return Err ( LabelError :: GptSignature { } ) ; } let checksum = gpt . self_checksum ; if gpt . checksum ( ) != checksum { return Err ( LabelError :: GptChecksum { } ) ; } Ok ( gpt ) }
converts a slice into a gpt header and verifies the validity of the data
converts a slice into a gpt header and verifies the validity of the data
slice
&[u8]