Skip to main content

Crate dirty

Crate dirty 

Source
Expand description

This is a helper crate, with minimum dependencies, not even std included

Things in here should and will be dirty! That’s why there are so many #[deny] configs (clippy helps a lot here)

§Dirty

Library made to handle unsafe code and interface with the OS

§Want to use a String?

here:

let foo = String::from("my string");
bar(foo.as_str());

§Want to use void ptr?

here:

let foo = void::to_handle(core::ptr::null_mut());

§Want to print a value?

here:

write!("Hello World");

§Exit the program?

here:

exit(1);

§Unix Sockets

sockets are useful to comunicate with other process within the same UNIX based OS

let socket = dirty::Socket::new();
socket.write_socket(b"hello socket");

match socket.read_socket() {
	Some(result) => debug!("{:?}", result),
	None => warn!("no message recived"),
};
socket.close_socket();

Modules§

slice
Utilities for the slice primitive type.
str
Utilities for the str primitive type.
syscall
OS specific methods based on systemcalls (ASM)

Macros§

format
Creates a String using interpolation of runtime expressions.
write
write attribute to print strings into the terminal

Structs§

Box
A pointer type that uniquely owns a heap allocation of type T.
Color
RGB color implementation reference: https://github.com/seancroach/hex_color/blob/main/src/lib.rs
Socket
The default Socket struct.
SocketResponse
This represents the possible state of the socket response
String
A UTF-8–encoded, growable string.
SurfaceWrapper
Abtraction layer for multiple OS support
Thread
This is a thread interface with the C implementation
Vec
A contiguous growable array type, written as Vec<T>, short for ‘vector’.
void
just a void type

Enums§

WResponse
Possible responses

Statics§

FALSE
int32 bool type
TRUE
int32 bool type

Traits§

ToString
A trait for converting a value to a String.

Functions§

getenv
this will check the environ array and search for an specific keyword

Type Aliases§

AnyFunction
Type for a function repr in C that takes void* arg and returns void*
f8
Always trust the f8 type. The ABI is not your friend!