//! `Face` type.

use crate::durandal::err::*;

/// Reads a `Face`.
pub fn read(b: &[u8]) -> ResultS<(Face, usize)>
{
   read_data! {
      endian: BIG, buf: b, size: 6, start: 0, data {
         let start = u16[0] usize;
         let face  = u16[2];
         let color = u16[4];
      }
   }

   Ok((Face{start, face, color}, 6))
}

/// A text face.
#[cfg_attr(feature = "serde_obj", derive(serde::Serialize))]
#[derive(Debug, Eq, PartialEq)]
pub struct Face
{
   pub start: usize,
   pub face:  u16,
   pub color: u16,
}

// EOF
