From 50f1bcb8511b5f950547ad52f5fc4d5bc1a533bc Mon Sep 17 00:00:00 2001 From: William Venner Date: Wed, 20 Oct 2021 22:44:59 +0100 Subject: [PATCH] Improve README --- README.md | 35 +++++++++++++++++++++++++++++++++++ gmod/src/lib.rs | 1 + 2 files changed, 36 insertions(+) diff --git a/README.md b/README.md index 7cff27b..1dbf421 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,38 @@ +[![crates.io](https://img.shields.io/crates/v/gmod.svg)](https://crates.io/crates/gmod) + +[![docs.rs](https://docs.rs/gmod/badge.svg)](https://docs.rs/gmod) + # ⚙ gmod-rs A swiss army knife for creating binary modules for Garry's Mod in Rust. + +# Example + +### Cargo.toml + +```toml +[lib] +crate-type = ["cdylib"] + +[dependencies] +gmod = "*" +``` + +### lib.rs + +```rust +#[macro_use] +extern crate gmod; + +#[gmod13_open] +fn gmod13_open(lua: gmod::lua::State) -> i32 { + println!("Hello from binary module!"); + 0 +} + +#[gmod13_close] +fn gmod13_close(lua: gmod::lua::State) -> i32 { + println!("Goodbye from binary module!"); + 0 +} +``` \ No newline at end of file diff --git a/gmod/src/lib.rs b/gmod/src/lib.rs index 3f5e347..9245247 100644 --- a/gmod/src/lib.rs +++ b/gmod/src/lib.rs @@ -1,3 +1,4 @@ +#![doc = include_str!("../../README.md")] #![feature(c_unwind)] pub use libloading;