Crates.io | c-arrow |
lib.rs | c-arrow |
version | 0.1.4 |
source | src |
created_at | 2021-03-24 03:31:16.49294 |
updated_at | 2021-03-24 06:40:26.369696 |
description | This Rust library allows you to use the arrow operator -> to access the field of the row pointer, just like C/C++. |
homepage | |
repository | https://github.com/AnarchY1n/c-arrow |
max_upload_size | |
id | 372809 |
size | 8,185 |
This Rust library allows you to use the arrow operator ->
to access the field of the row pointer, just like C/C++.
pt![
<link>]
get a mutable reference of the pointed field.
pt![
<link> =
<expression>];
assign expression to the pointed field.
pt![
<link> =
<link>];
assign the pointed field to the other pointed field.
Objects | Explanations |
---|---|
<func> | A function returning the *mut pointer of a struct. |
<met> | A method which returns the *mut pointer of a struct. |
<ptr>-> <field> |
Dereferences and accesses the field. |
<struct>. <field> |
Accesses the field directly. |
<link> | (<func> | <ptr> | <struct>) ((-> | . )(<field> | <met>))+ |
let mut stack: Stack<char> = Stack::new();
"abcdefgh"
.chars()
.for_each(|c| stack.push(c));
use c_arrow::{ pt, ref_pt };
let top_back = pt![stack.top->back];
pt![back_of(top_back)->back->data = 'x'];
pt![stack.top->backs(4)->data = stack.back_of_top()->data];