Skip to content

Commit 150a689

Browse files
authored
Merge pull request #29 from rust-embedded-community/cleanup_docs
Cleanup docs
2 parents d13967b + 27daed5 commit 150a689

File tree

8 files changed

+65
-55
lines changed

8 files changed

+65
-55
lines changed

Cargo.toml

+40-39
Original file line numberDiff line numberDiff line change
@@ -21,60 +21,61 @@ cc = "1.0"
2121
default = ["all"]
2222
all = [
2323
"abs",
24+
"atoi",
25+
"isalpha",
26+
"isdigit",
27+
"isspace",
28+
"isupper",
29+
"itoa",
30+
"memchr",
31+
"qsort",
32+
"snprintf",
33+
"strcat",
34+
"strchr",
2435
"strcmp",
25-
"strncmp",
26-
"strncasecmp",
2736
"strcpy",
28-
"strcat",
29-
"strncpy",
3037
"strlen",
38+
"strncasecmp",
39+
"strncmp",
40+
"strncpy",
41+
"strrchr",
42+
"strstr",
43+
"strtoimax",
3144
"strtol",
32-
"strtoul",
3345
"strtoll",
46+
"strtoul",
3447
"strtoull",
35-
"strtoimax",
3648
"strtoumax",
37-
"strstr",
38-
"strchr",
39-
"strrchr",
40-
"atoi",
4149
"utoa",
42-
"itoa",
43-
"snprintf",
44-
"isspace",
45-
"isdigit",
46-
"isalpha",
47-
"isupper",
48-
"memchr",
49-
"qsort",
5050
]
51+
5152
abs = []
53+
alloc = []
54+
atoi = []
55+
isalpha = []
56+
isdigit = []
57+
isspace = []
58+
isupper = []
59+
itoa = []
60+
memchr = []
61+
qsort = []
62+
signal = ["dep:portable-atomic"]
63+
signal-cs = ["portable-atomic/critical-section"]
64+
snprintf = []
65+
strcat = []
66+
strchr = []
5267
strcmp = []
53-
strncmp = []
54-
strncasecmp = []
5568
strcpy = []
56-
strcat = []
57-
strncpy = []
5869
strlen = []
70+
strncasecmp = []
71+
strncmp = []
72+
strncpy = []
73+
strrchr = []
74+
strstr = []
75+
strtoimax = []
5976
strtol = []
60-
strtoul = []
6177
strtoll = []
78+
strtoul = []
6279
strtoull = []
63-
strtoimax = []
6480
strtoumax = []
65-
strstr = []
66-
strchr = []
67-
strrchr = []
68-
atoi = []
6981
utoa = []
70-
itoa = []
71-
snprintf = []
72-
isspace = []
73-
isdigit = []
74-
isalpha = []
75-
isupper = []
76-
alloc = []
77-
memchr = []
78-
qsort = []
79-
signal = ["dep:portable-atomic"]
80-
signal-cs = ["portable-atomic/critical-section"]

src/ctype.rs

+7-4
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,10 @@ pub type CInt = ::core::ffi::c_int;
3737
/// `unsigned int`
3838
pub type CUInt = ::core::ffi::c_uint;
3939

40-
/// Represents an 8-bit `char`. Rust does not (and will never) support
41-
/// platforms where `char` is not 8-bits long.
40+
/// Represents an 8-bit `char`.
41+
///
42+
/// Rust does not (and will never) support platforms where `char` is not 8-bits
43+
/// long.
4244
pub type CChar = u8;
4345

4446
/// This allows you to iterate a null-terminated string in a relatively simple
@@ -49,8 +51,9 @@ pub struct CStringIter {
4951
}
5052

5153
impl CStringIter {
52-
/// Create a new iterator from a pointer to a null-terminated string. The
53-
/// behaviour is undefined if the string is not null-terminated.
54+
/// Create a new iterator from a pointer to a null-terminated string.
55+
///
56+
/// The behaviour is undefined if the string is not null-terminated.
5457
pub fn new(s: *const CChar) -> CStringIter {
5558
CStringIter { ptr: s, idx: 0 }
5659
}

src/signal.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,9 @@ const SIG_DFL_ATOMIC: AtomicUsize = AtomicUsize::new(SIG_DFL);
1515

1616
/// Our array of registered signal handlers.
1717
///
18-
/// Signals in C are either 0, 1, -1, or a function pointer. We cast function
19-
/// pointers into `usize` so they can be stored in this array.
18+
/// Signals in C are either 0, 1, -1, or a function pointer.
19+
///
20+
/// We cast function pointers into `usize` so they can be stored in this array.
2021
static SIGNAL_HANDLERS: [AtomicUsize; 16] = [SIG_DFL_ATOMIC; 16];
2122

2223
/// A signal handler - either a function pointer or a magic integer.

src/strcat.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@
44
55
use crate::CChar;
66

7-
/// Rust implementation of C library function `strcat`. Passing NULL
8-
/// (core::ptr::null()) gives undefined behaviour.
7+
/// Rust implementation of C library function `strcat`.
8+
///
9+
/// Passing NULL (core::ptr::null()) gives undefined behaviour.
910
#[cfg_attr(feature = "strcat", no_mangle)]
1011
pub unsafe extern "C" fn strcat(dest: *mut CChar, src: *const CChar) -> *const CChar {
1112
crate::strcpy::strcpy(dest.add(crate::strlen::strlen(dest)), src);

src/strcpy.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@
44
55
use crate::CChar;
66

7-
/// Rust implementation of C library function `strcpy`. Passing NULL
8-
/// (core::ptr::null()) gives undefined behaviour.
7+
/// Rust implementation of C library function `strcpy`.
8+
///
9+
/// Passing NULL (core::ptr::null()) gives undefined behaviour.
910
#[cfg_attr(feature = "strcpy", no_mangle)]
1011
pub unsafe extern "C" fn strcpy(dest: *mut CChar, src: *const CChar) -> *const CChar {
1112
let mut i = 0;

src/strncasecmp.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@
44
55
use crate::{CChar, CInt};
66

7-
/// Rust implementation of C library function `strncasecmp`. Passing NULL
8-
/// (core::ptr::null()) gives undefined behaviour.
7+
/// Rust implementation of C library function `strncasecmp`.
8+
///
9+
/// Passing NULL (core::ptr::null()) gives undefined behaviour.
910
#[cfg_attr(feature = "strncasecmp", no_mangle)]
1011
pub unsafe extern "C" fn strncasecmp(s1: *const CChar, s2: *const CChar, n: usize) -> CInt {
1112
for i in 0..n {

src/strncmp.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@
55
66
use crate::{CChar, CInt};
77

8-
/// Rust implementation of C library function `strncmp`. Passing NULL
9-
/// (core::ptr::null()) gives undefined behaviour.
8+
/// Rust implementation of C library function `strncmp`.
9+
///
10+
/// Passing NULL (core::ptr::null()) gives undefined behaviour.
1011
#[cfg_attr(feature = "strncmp", no_mangle)]
1112
pub unsafe extern "C" fn strncmp(s1: *const CChar, s2: *const CChar, n: usize) -> crate::CInt {
1213
for i in 0..n as isize {

src/strncpy.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@
55
66
use crate::CChar;
77

8-
/// Rust implementation of C library function `strncmp`. Passing NULL
9-
/// (core::ptr::null()) gives undefined behaviour.
8+
/// Rust implementation of C library function `strncmp`.
9+
///
10+
/// Passing NULL (core::ptr::null()) gives undefined behaviour.
1011
#[cfg_attr(feature = "strncpy", no_mangle)]
1112
pub unsafe extern "C" fn strncpy(
1213
dest: *mut CChar,

0 commit comments

Comments
 (0)