1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
//! # Description
//! This Rust library allows you to use the arrow operator `->` to access the field of the row pointer, just like C/C++.
//! # Usage
//! `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.
//!
//! ### Explanation
//! | 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\>))+ |
//!
//! # Example
//! ```rust
//! let mut stack: Stack<char> = Stack::new();
//! "abcdefgh"
//! .chars()
//! .for_each(|c| stack.push(c));
//! unsafe {
//! 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];
//! }
//! ```