YatoRust

u/YatoRust




r/rust•

This library is very similar to aljabar (in fact it was inspired by it). It improves upon it by giving panic safety and elementwise access (edit: latest update of aljabar does have these properties, but it still leaks on panics, whereas const-alg does not leak on panics). Also it gives iterators over rows and columns!

This is backed by my second crate, array-vec, which is a minimal fixed capacity vector backed by an array.

https://crates.io/crates/const-alg

https://crates.io/crates/array-vec

You can create a matrix very simply, just do

use const_alg::Matrix;

Matrix(
    [[0, 1, 2],
     [3, 4, 5]]
)

and that will cr

208

r/rust•

Relative Pointer: an abstraction to build movable self-referential types

https://crates.io/crates/rel-ptr

Use relative pointers to build safe movable self-referential types or minimize the size of your pointers!

Example of self referential struct

use rel_ptr::RelPtr;

struct SelfRef {
    value: (String, u32),
    ptr: RelPtr<String>
}

impl SelfRef {
    pub fn new(s: String, i: u32) -> Self {
        let mut this = Self {
            value: (s, i),
            ptr: RelPtr::null()
        };
        
        this.ptr.set(&this.value.0).unwrap();
        
        this
    }

    pub fn fst(&self) -> &
5425


You've reached the end of this feed.