pub enum PdbRecordHeader {
    Record {
        attributes: RecordAttributes,
        unique_id: u32,
        data_offset: u32,
        data_len: Option<u32>,
    },
    Resource {
        name: [u8; 4],
        record_id: u16,
        data_offset: u32,
        data_len: Option<u32>,
    },
}
Expand description

Generic Palm database record header

This type can represent either a “record” or a “resource” within a Palm OS database:

  • Records are potentially-mutable entries that are used in PDB databases to represent content;
  • Resources are generally-immutable data entries that are used, as the name would suggest, for application resources, and are found within PRC files.

Which type to use to decode a given record header should be determined by the lowest bit in the attributes field of the DatabaseHeader for this record’s containing database - if that bit is cleared, “records” are used; if it is set, “resources” are used.

These two types are presented as an enum for the sake of flexibility, and to allow sharing encoding/decoding code between the two available record header types.

Variants§

§

Record

Fields

§attributes: RecordAttributes
§unique_id: u32
§data_offset: u32
§data_len: Option<u32>
§

Resource

Fields

§name: [u8; 4]
§record_id: u16
§data_offset: u32
§data_len: Option<u32>

Trait Implementations§

source§

impl Clone for PdbRecordHeader

source§

fn clone(&self) -> PdbRecordHeader

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl DatabaseRecord for PdbRecordHeader

source§

fn from_bytes( hdr: &DatabaseHeader, rdr: &mut Cursor<&[u8]> ) -> Result<Self, Error>

Read the record header from the given byte array
source§

fn to_bytes(&self) -> Result<Vec<u8>, Error>

Write the record header to a new Vec<u8>
source§

fn name_str(&self) -> Option<&str>

Return the record’s name, if known
source§

fn attributes(&self) -> Option<RecordAttributes>

Return the record’s attributes, if known
source§

fn data_len(&self) -> Option<u32>

Return the length of the record’s data, if known
source§

fn unique_id(&self) -> Option<u32>

Return the unique id if the record is not a resource
source§

fn resource_id(&self) -> Option<u16>

Return the resource id if the record is a resource
source§

fn construct_record( attributes: RecordAttributes, unique_id: u32, data_offset: u32, data_len: Option<u32> ) -> Self

Construct a record with the given parameters
source§

fn construct_resource( name: &[u8; 4], record_id: u16, data_offset: u32, data_len: Option<u32> ) -> Self

Construct a resource with the given parameters
source§

impl Debug for PdbRecordHeader

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl PartialEq<PdbRecordHeader> for PdbRecordHeader

source§

fn eq(&self, other: &PdbRecordHeader) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Copy for PdbRecordHeader

source§

impl StructuralPartialEq for PdbRecordHeader

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.