zig-std 0.1.1

Bindings to Zig `std`, with optional Rust `std` features
Documentation
pub const std_lang = @import("std").lang;

pub const AtomicOrder = enum(u8) {
	unordered = 0,
	monotonic = 1,
	acquire = 2,
	release = 3,
	acq_rel = 4,
	seq_cst = 5,

	inline fn from_std(order: std_lang.AtomicOrder) @This() {
		return switch (order) {
			.unordered => .unordered,
			.monotonic => .monotonic,
			.acquire => .acquire,
			.release => .release,
			.acq_rel => .acq_rel,
			.seq_cst => .seq_cst
		};
	}

	inline fn to_std(self: @This()) std_lang.AtomicOrder {
		return switch (self) {
			.unordered => .unordered,
			.monotonic => .monotonic,
			.acquire => .acquire,
			.release => .release,
			.acq_rel => .acq_rel,
			.seq_cst => .seq_cst
		};
	}
};

comptime {
	const assert = @import("std").debug.assert;

	// smoke tests
	_ = AtomicOrder.from_std(AtomicOrder.monotonic.to_std());

	// size/align assertions
	assert(@sizeOf(AtomicOrder) == 1);
	assert(@alignOf(AtomicOrder) == 1);
}