resource-fork-types 0.1.0

Support for reading common resource fork types in rust
Documentation
use binrw::BinRead;
use resource_fork::Resource;

use crate::common::Rect;

#[derive(Resource, BinRead, Debug)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[resource(code = "DLOG")]
#[br(big)]
/// See https://dev.os9.ca/techpubs/new/DialogMgr8Ref/DialogMgrRef.9.html#16699
pub struct Dialog {
    pub bounds: Rect,
    proc_id: u16,
    #[br(map(|v: u16|  v != 0))]
    pub visible: bool,
    #[br(map(|v: u16|  v != 0))]
    pub closable: bool,
    ref_con: u32,
    pub item_list: u16,
    #[br(map(macintosh_utils::string))]
    pub title: String,
    #[br(try, align_before = 2)]
    pub alignment: Option<u16>,
}

#[derive(Resource, BinRead, Debug)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[resource(code = "DLGX")]
#[br(big)]
/// See https://dev.os9.ca/techpubs/new/DialogMgr8Ref/DialogMgrRef.9.html#20331
pub struct ExtendedDialog {
    version: u16,
    flags: u32,
}