Skip to content

Commit 059aec8

Browse files
committed
1. Small corrections
1 parent 8f1672c commit 059aec8

File tree

2 files changed

+35
-4
lines changed

2 files changed

+35
-4
lines changed

README.md

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ Safe creation of “CStr” with zero cost at the compilation stage with checkin
1414

1515
# Use
1616
```
17-
1817
#![feature(plugin)]
1918
#![plugin(clucstr)]
2019
@@ -67,9 +66,25 @@ fn my_function(num: usize, a: &'static CStr) {
6766
}
6867
```
6968

70-
# Panic
69+
# EasyUse
70+
71+
```
72+
#![feature(plugin)]
73+
#![plugin(clucstr)]
74+
75+
use std::ffi::CStr;
76+
77+
fn main() {
78+
let cstr = cstr!("My CSTR!");
79+
//&CStr
80+
81+
assert_eq!(cstr.to_bytes(), b"My CSTR!");
82+
assert_eq!(cstr.to_bytes_with_nul(), b"My CSTR!\0");
83+
}
7184
```
7285

86+
# Panic
87+
```
7388
#![feature(plugin)]
7489
#![plugin(clucstr)]
7590

src/lib.rs

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ Safe creation of “CStr” with zero cost at the compilation stage with checkin
2727
2828
# Use
2929
```
30-
3130
#![feature(plugin)]
3231
#![plugin(clucstr)]
3332
@@ -80,9 +79,26 @@ fn my_function(num: usize, a: &'static CStr) {
8079
}
8180
```
8281
83-
# Panic
82+
# EasyUse
83+
8484
```
85+
#![feature(plugin)]
86+
#![plugin(clucstr)]
87+
88+
use std::ffi::CStr;
8589
90+
fn main() {
91+
let cstr = cstr!("My CSTR!");
92+
//&CStr
93+
94+
assert_eq!(cstr.to_bytes(), b"My CSTR!");
95+
assert_eq!(cstr.to_bytes_with_nul(), b"My CSTR!\0");
96+
}
97+
```
98+
99+
100+
# Panic
101+
```
86102
#![feature(plugin)]
87103
#![plugin(clucstr)]
88104

0 commit comments

Comments
 (0)