Giter Site home page Giter Site logo

rsapar's Introduction

👋 Overview

RSaPar is a Rust library for schema-based parsing and validation of structured data files, inspired by JSaPar for Java.

💻 Usage

To use RSaPar, you need to define a ParserConfig and then call the parser() method.

Here's a step-by-step guide on how to get started:

  1. Add RSaPar to your project with:

    cargo add rsapar
  2. Define the data schema: Create a schema XML file (schema.xml) to describe the structure of your data. The schema format attempts to follow the same rules as JSaPar's schema format. Detailed documentation on the support and compatibility with the JSaPar schema format in RSaPar will be provided soon. An example schema can be found in the example folder.

  3. Configure the parser: Set up the parser configuration with the path to your data file, the number of workers, and the path to your schema file.

    Example:

    let config = crate::ParserConfig {
        file_path: "./example/fixedwidth_data.txt".to_string(),
        file_schema: "./example/fixedwidth_schema.xml".to_string(),
    };
    
    let mut parser = Parser::new(config).unwrap();
    
    for line_result in parser.iter_mut() {
        match line_result {
            Ok(processed_line) => println!("{:?}", processed_line),
            Err(processed_line) => println!("Error processing line: {:?}", processed_line),
        }
    }

This setup provides a brief overview of how to start using RSaPar. The schema structure is inspired by JSaPar, and more information on this alignment will be available in the future.

🚀 Roadmap

  • Full support for validation of fixed-width files (v0.1.2)

For more details on upcoming features and releases, check out the milestones

💫 Contributions

Contributions make the open source community thrive. Your contributions to RSaPar are greatly appreciated!

To contribute, fork the repo, create your feature branch, and submit a pull request. For bugs or suggestions, please open an issue with the appropriate tag (bug for bugs, enhancement for improvements). Don’t forget to star the project!

Thank you for your support!

🧪 Testing

To run the tests and benchmarks, use the following commands:

cargo test
cargo bench

To use the latest development version of RSaPar in your project, add the following to your Cargo.toml file:

[dependencies]
rsapar = {git = "https://github.com/dertin/rsapar.git", branch = "main"}

Then, regularly run cargo update -p rsapar to fetch the latest main branch commit.

🪪 License

Distributed under the MIT or Apache-2.0 License.

Please note that while RSaPar attempts to follow the same schema format rules as JSaPar, it is a separate implementation and does not reuse the JSaPar codebase.

rsapar's People

Contributors

dertin avatar

Stargazers

Davide R. Wiest avatar Jonas Stenberg avatar Andrés Céspedes avatar Ted Feng avatar Clayton Kehoe avatar  avatar

Watchers

 avatar Andrés Céspedes avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.