This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const std = @import("std"); | |
// Just a simple struct representing a http route | |
// you can image this having a handler: fn() HttpResponse | |
// of some kind. | |
const Route = struct { | |
url: []const u8, | |
}; | |
// a router namespace |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int main() { | |
void *instructions[5]; | |
int ip = 0; | |
int n = 0; | |
int a, b; | |
a = 10; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#![feature(const_for)] | |
#![feature(const_refs_to_cell)] | |
#![feature(const_trait_impl)] | |
#![feature(generic_const_exprs)] | |
use { | |
core::{ | |
ops::{Div, Mul, Not, Add} | |
}, | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::collections::HashMap; | |
const SRC: &str = " | |
function x | |
pop r1 | |
pop r2 | |
add r1 20 | |
add r1 r2 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#![feature(const_ptr_is_null)] | |
#![feature(const_ptr_write)] | |
#![feature(const_mut_refs)] | |
#![feature(core_intrinsics)] | |
#![feature(inline_const)] | |
#![feature(const_heap)] | |
use core::intrinsics::{const_allocate, const_deallocate}; | |
struct CVec<T> { | |
ptr: *mut T, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#![feature(const_slice_index)] | |
#![feature(inline_const)] | |
#![feature(strict_provenance)] | |
#![feature(const_raw_ptr_comparison)] | |
#![feature(const_mut_refs)] | |
#![feature(const_trait_impl)] | |
use core::marker::PhantomData; | |
trait ConstIterator { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const List = struct { | |
const Node = struct { | |
value: u32, | |
next: ?*Node = null, | |
}; | |
head: ?*Node = null, | |
fn addNode(this: *@This(), node: *Node) void { | |
node.next = this.head; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//#![feature(generic_associated_types)] | |
use std::ops::DerefMut; | |
trait PointerFamily { | |
type Pointer<'a, T: ?Sized + 'a>: DerefMut<Target = T>; | |
} | |
#[derive(Debug)] | |
struct RefFamily; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#![feature(const_type_name)] | |
#![feature(const_refs_to_cell)] | |
#![feature(const_trait_impl)] | |
#![feature(generic_const_exprs)] | |
use core::ops::{Div, Mul, Not}; | |
trait TableRaw<const SIZE: usize>: Sized + Copy { | |
const TABLE: [Self; SIZE]; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//=============BUILD.ZIG=============== | |
const std = @import("std"); | |
pub fn build(b: *std.build.Builder) void { | |
// Standard release options allow the person running `zig build` to select | |
// between Debug, ReleaseSafe, ReleaseFast, and ReleaseSmall. | |
const mode = b.standardReleaseOptions(); | |
const lib = b.addStaticLibrary("SelectList", "src/main.zig"); | |
lib.setBuildMode(mode); |
NewerOlder