Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Webwire command-line Interface
Webwire is a contract-first API system which features an interface description language a network protocol and code generator for both servers and clients.
This repository contains the the command-line interface used to validate Webwire IDL files and generate code and documentation.
To learn more about webwire in general please visit the documentation repository webwire/webwire-docs.
Example
The following example assumes a Rust server and a TypeScript client. Webwire is by no means limited to those two but those languages show the potential of webwire best.
Given the following IDL file:
struct HelloRequest {
name: String,
}
struct HelloResponse {
message: String,
}
service Hello {
hello: HelloRequest -> HelloResponse
}
The server and client files can be generated using the code generator:
A Rust server implementation for the given code would look like this:
use SocketAddr;
use ;
use async_trait;
use chat;
use MakeHyperService;
use ;
use ;
async
A TypeScript client using the generated code would look like that:
import { Client } from 'webwire'
import api from 'api' // this is the generated code
let client = new Client('http://localhost:8000/', [
api.chat.ClientProvider({
async on_message(message) {
console.log("Message received:", message)
}
})
])
assert(await client.connect())
let chat = api.chat.ServerConsumer(client)
let response = await chat.message({ text: "Hello world!" })
assert(response.Ok === null)
License
Licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.