save-load-derive 0.1.2

`save-load-derive` is a procedural macro crate enabling automatic derivation of asynchronous file save and load functionalities for structs, leveraging `serde` serialization and `tokio` for async operations.
Documentation
# save-load-derive

`save-load-derive` is a Rust crate designed to streamline file serialization and deserialization processes for custom types by utilizing procedural macros. It automatically generates implementations for the `SaveToFile` and `LoadFromFile` traits using `serde` for serialization and `tokio` for asynchronous file operations.

## Features

- **Automated Code Generation:** Utilizes Rust's procedural macros to derive `SaveToFile` and `LoadFromFile` implementations, reducing boilerplate.
- **Asynchronous Operations:** Employs `tokio` to facilitate asynchronous reading from and writing to files, enhancing performance in I/O bound tasks.
- **Serialize and Deserialize:** Leverages `serde` to support the versatile serialization and deserialization of types.
- **Error Handling:** Implements custom error handling using a defined `SaveLoadError` type.

## Usage

To use the `save-load-derive` crate, apply the `SaveLoad` derive macro to your structs:

```rust
use save_load_derive::SaveLoad;

#[derive(SaveLoad)]
struct MyData {
    // your fields here
}
```

Ensure your type derives or implements `serde::Serialize` and `for<'de> serde::Deserialize<'de>` for the macro to succeed without compile errors due to missing trait bounds.

### Example

```rust
use save_load_derive::SaveLoad;
use serde::{Serialize, Deserialize};

#[derive(SaveLoad, Serialize, Deserialize)]
struct ExampleStruct {
    field1: String,
    field2: i32,
}

// In asynchronous contexts:
async fn process() -> Result<(), SaveLoadError> {
    let data = ExampleStruct {
        field1: "data".into(),
        field2: 42,
    };

    data.save_to_file("example.json").await?;
    let loaded_data = ExampleStruct::load_from_file("example.json").await?;
    Ok(())
}
```

## License

This crate is licensed under the MIT License.

---

*Note: This README was generated by an AI model and may not be 100% accurate, although it aims to be comprehensive and useful.*