Versa Rust
This crate is the official Versa SDK for Rust.
Versa uses semantic versioning to ensure the stability of its data model. The current schema version is 2.1.1
You can use this crate broadly in two ways: either just referencing the type bindings, or to implement a custom client in Rust.
You will need to enable either the client_sender or client_receiver feature to leverage the corresponding client implementation.
Documentation
Full API documentation is available at docs.rs/versa.
Quick Start
As a Sender
[]
= { = "1", = ["client_sender"] }
= { = "1", = ["full"] }
use VersaClient;
use VersaSender;
use TransactionHandles;
use Receipt;
async
As a Receiver
[]
= { = "1", = ["client_receiver"] }
See the documentation for complete examples.
Type Bindings
There are broadly two kinds of types represented in this repository: Protocol Bindings and the Receipt Schema
This repository references the root JSON schema files, at https://github.com/versa-protocol/schema, to generate the Rust bindings for a Versa receipt.
Protocol Bindings
Protocol Bindings represent the types of requests, responses, and error codes to be expected when developing client implementations according to the specifications of the Versa Protocol. These types are defined in the protocol directory.
Receipt Schema
The Receipt struct represents the receipt and invoice data schemas to be handled when developing client implementations according to the specifications of the Versa Protocol. These types are defined in receipt.rs
Build Process
This crate uses the typify crate to construct the receipt schema bindings from our json schema
Features
clientEnables Versa client initialization with customer registration APIsclient_senderEnables the Versa sending client implementationclient_receiverEnables the Versa receiving client implementationdieselImplements diesel traits for MySQL on certain structs (UNSTABLE: Use with caution)validatorIncludes features related to validation of the Versa schema
Schema Validation
The validator feature makes it simple to validate incoming data from the Versa network and to generate a misuse code if necessary. Example usage:
use Value;
use ;
pub async
For Developers
Interested in contributing to the official crate? Get started below:
Codegen
To avoid bundling build-dependencies like reqwest into the crate regardless of feature, codegen is a separate script (rather than employing build.rs).
Make sure rust-script is installed, then run rust-script ./codegen.rs