moirai-async 0.5.0

Async/await support for Moirai concurrency library
Documentation
/// Configuration for file operations
#[derive(Debug, Clone)]
pub struct FileOpenOptions {
    /// Open for reading
    pub read: bool,
    /// Open for writing
    pub write: bool,
    /// Create if not exists
    pub create: bool,
    /// Append mode
    pub append: bool,
    /// Truncate existing content
    pub truncate: bool,
}

impl Default for FileOpenOptions {
    fn default() -> Self {
        Self {
            read: true,
            write: false,
            create: false,
            append: false,
            truncate: false,
        }
    }
}

impl FileOpenOptions {
    /// Create options for read-only access
    pub fn read_only() -> Self {
        Self {
            read: true,
            write: false,
            create: false,
            append: false,
            truncate: false,
        }
    }

    /// Create options for write-only access (creates if not exists)
    pub fn write_only() -> Self {
        Self {
            read: false,
            write: true,
            create: true,
            append: false,
            truncate: true,
        }
    }

    /// Create options for append access
    pub fn append_only() -> Self {
        Self {
            read: false,
            write: true,
            create: true,
            append: true,
            truncate: false,
        }
    }

    /// Create options for read-write access
    pub fn read_write() -> Self {
        Self {
            read: true,
            write: true,
            create: true,
            append: false,
            truncate: false,
        }
    }
}