tree-type 0.4.5

Rust macros for creating type-safe filesystem tree structures
Documentation
#![cfg_attr(feature = "walk", allow(deprecated))]
/// Test walk_dir method availability on dir_type and tree_type with walk feature
#[cfg(feature = "walk")]
use tree_type::dir_type;
/// Test walk_dir method availability on dir_type and tree_type with walk feature
#[cfg(feature = "walk")]
use tree_type::tree_type;

#[cfg(feature = "walk")]
#[test]
fn test_dir_type_has_walk_dir() {
    dir_type!(TestDir);

    let temp = tempfile::tempdir().unwrap();
    let test_dir = TestDir::new(temp.path()).unwrap();

    // This should compile if walk_dir is available
    let _walker = test_dir.walk_dir();
}

#[cfg(feature = "walk")]
#[test]
fn test_tree_type_root_has_walk_dir() {
    tree_type! {
        TestRoot {
            subdir/
        }
    }

    let temp = tempfile::tempdir().unwrap();
    let root = TestRoot::new(temp.path()).unwrap();

    // This should compile if walk_dir is available on tree_type root
    let _walker = root.walk_dir();
}

#[cfg(feature = "walk")]
#[test]
fn test_tree_type_empty_subdir_has_walk_dir() {
    tree_type! {
        TestRoot2 {
            empty_subdir/
        }
    }

    let temp = tempfile::tempdir().unwrap();
    let root = TestRoot2::new(temp.path()).unwrap();

    // This should compile if walk_dir is available on empty subdirectories
    let _walker = root.empty_subdir().walk_dir();
}

#[cfg(feature = "walk")]
#[test]
fn test_tree_type_subdir_with_children_has_walk_dir() {
    tree_type! {
        TestRoot3 {
            subdir/ {
                child/
            }
        }
    }

    let temp = tempfile::tempdir().unwrap();
    let root = TestRoot3::new(temp.path()).unwrap();

    // This should compile if walk_dir is available on subdirectories with children
    let _walker = root.subdir().walk_dir();
}

#[cfg(feature = "walk")]
#[test]
fn test_tree_type_empty_subdir_has_size_in_bytes() {
    tree_type! {
        TestRoot4 {
            empty_subdir/
        }
    }

    let temp = tempfile::tempdir().unwrap();
    let root = TestRoot4::new(temp.path()).unwrap();
    root.sync().unwrap();

    // This should compile if size_in_bytes is available on empty subdirectories
    let _size = root.empty_subdir().size_in_bytes().unwrap();
}