FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
arrayvec/src/array.rs at arrayvec-copy-2 · gz/arrayvec · GitHub
gz
/
arrayvec
Public
forked from
bluss/arrayvec
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
arrayvec
/
src
/
array.rs
Copy path
More file actions
More file actions
Latest commit
History
History
History
63 lines (55 loc) · 1.83 KB
Breadcrumbs
arrayvec
/
src
/
array.rs
Copy path
File metadata and controls
63 lines (55 loc) · 1.83 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
/// Trait for fixed size arrays.
pub
unsafe
trait
Array
{
/// The array's element type
type
Item
;
#
[
doc
(
hidden
)
]
/// The smallest index type that indexes the array.
type
Index
:
Index
;
#
[
doc
(
hidden
)
]
fn
as_ptr
(
&
self
)
->
*
const
Self
::
Item
;
#
[
doc
(
hidden
)
]
fn
as_mut_ptr
(
&
mut
self
)
->
*
mut
Self
::
Item
;
#
[
doc
(
hidden
)
]
fn
capacity
(
)
->
usize
;
}
pub
trait
Index
:
PartialEq
+
Copy
{
fn
to_usize
(
self
)
->
usize
;
fn
from
(
usize
)
->
Self
;
}
impl
Index
for
u8
{
#
[
inline
(
always
)
]
fn
to_usize
(
self
)
->
usize
{
self
as
usize
}
#
[
inline
(
always
)
]
fn
from
(
ix
:
usize
)
->
Self
{
ix
as
u8
}
}
impl
Index
for
u16
{
#
[
inline
(
always
)
]
fn
to_usize
(
self
)
->
usize
{
self
as
usize
}
#
[
inline
(
always
)
]
fn
from
(
ix
:
usize
)
->
Self
{
ix
as
u16
}
}
macro_rules!
fix_array_impl
{
(
$index_type
:
ty
,
$len
:
expr
)
=>
(
unsafe
impl
<
T
>
Array
for
[
T
;
$len
]
{
type
Item
=
T
;
type
Index
= $index_type
;
#
[
inline
(
always
)
]
fn
as_ptr
(
&
self
)
->
*
const
T
{
self
as
*
const
_
as
*
const
_
}
#
[
inline
(
always
)
]
fn
as_mut_ptr
(
&
mut
self
)
->
*
mut
T
{
self
as
*
mut
_
as
*
mut
_
}
#
[
inline
(
always
)
]
fn
capacity
(
)
->
usize
{
$len
}
}
)
}
macro_rules!
fix_array_impl_recursive
{
(
$index_type
:
ty
,
)
=>
(
)
;
(
$index_type
:
ty
,
$len
:
expr
,
$
(
$more
:
expr
,
)
*
)
=>
(
fix_array_impl!
(
$index_type
,
$len
)
;
fix_array_impl_recursive!
(
$index_type
,
$
(
$more
,
)
*
)
;
)
;
}
fix_array_impl_recursive
!
(
u8
,
0
,
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
,
40
,
48
,
56
,
64
,
72
,
96
,
128
,
160
,
192
,
224
,
)
;
fix_array_impl_recursive
!
(
u16
,
256
,
384
,
512
,
768
,
1024
,
2048
,
4096
,
8192
,
16384
,
32768
,
)
;
Back
|
FazBrowse Home
|
New Git URL