Skip to content

Instantly share code, notes, and snippets.

View AchalaSB's full-sized avatar
🚀
#BUIDL

Achala Bhatt AchalaSB

🚀
#BUIDL
View GitHub Profile
@AchalaSB
AchalaSB / main.rs
Created July 10, 2020 16:08
String testing
use std::ffi::{CStr, CString};
use std::os::raw::{c_char};
use std::mem;
#[no_mangle]
pub extern fn allocate(size: usize) -> *mut c_char {
let mut data = Vec::with_capacity(size);
let subject = data.as_mut_ptr();
// Avoid memory leakage
{
"items": [
{
"fn": {
"attrs": [
{
"style": "outer",
"path": {
"segments": [
{
{
"items": [
{
"fn": {
"attrs": [
{
"style": "outer",
"path": {
"segments": [
{
@AchalaSB
AchalaSB / Cargo.toml
Created November 17, 2019 07:01
Syn parser
[package]
name = "hello_rust"
version = "0.1.0"
authors = ["AchalaSB <achalasbhatt@gmail.com>"]
edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
syn = {version = "0.13", features = ["full", "extra-traits"] }

Keybase proof

I hereby claim:

  • I am achalasb on github.
  • I am achhu (https://keybase.io/achhu) on keybase.
  • I have a public key ASDBAziN0L_wXFz5aNkKx4RYQWvTGg2ocNtgRlUlFID--Ao

To claim this, I am signing this object:

package main
import (
"fmt"
"../runtime"
)
func main() {
r, err := runtime.NewRuntime("simple.wasm")