use crate::{range::ByteRange, segment::Name};
#[derive(Debug, Clone, Copy)]
#[non_exhaustive]
pub struct Node<'a> {
pub path: &'a str,
pub name: Name,
pub range: ByteRange,
pub header_len: u32,
pub depth: u32,
pub version: Option<u8>,
pub flags: Option<u32>,
pub user_type: Option<[u8; 16]>,
}
impl<'a> Node<'a> {
pub const fn new(
path: &'a str,
name: Name,
range: ByteRange,
header_len: u32,
depth: u32,
) -> Self {
Self {
path,
name,
range,
header_len,
depth,
version: None,
flags: None,
user_type: None,
}
}
pub const fn with_full_box(mut self, version: u8, flags: u32) -> Self {
self.version = Some(version);
self.flags = Some(flags);
self
}
pub const fn with_user_type(mut self, user_type: [u8; 16]) -> Self {
self.user_type = Some(user_type);
self
}
}