Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
syscall
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
8
Issues
8
List
Boards
Labels
Service Desk
Milestones
Merge Requests
9
Merge Requests
9
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
redox-os
syscall
Commits
8d0015be
Commit
8d0015be
authored
Feb 10, 2020
by
Jeremy Soller
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'improved-mmio' into 'master'
Allow Mmio to work with const fn See merge request
!43
parents
6beba083
e380f6b3
Pipeline
#6968
failed with stages
in 1 minute
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
3 deletions
+17
-3
src/error.rs
src/error.rs
+1
-1
src/io/mmio.rs
src/io/mmio.rs
+16
-2
No files found.
src/error.rs
View file @
8d0015be
...
...
@@ -5,7 +5,7 @@ pub struct Error {
pub
errno
:
i32
,
}
pub
type
Result
<
T
>
=
result
::
Result
<
T
,
Error
>
;
pub
type
Result
<
T
,
E
=
Error
>
=
result
::
Result
<
T
,
E
>
;
impl
Error
{
pub
fn
new
(
errno
:
i32
)
->
Error
{
...
...
src/io/mmio.rs
View file @
8d0015be
...
...
@@ -11,9 +11,23 @@ pub struct Mmio<T> {
impl
<
T
>
Mmio
<
T
>
{
/// Create a new Mmio without initializing
#[deprecated
=
"unsound because it's possible to read even though it's uninitialized"
]
pub
fn
new
()
->
Self
{
Mmio
{
value
:
MaybeUninit
::
uninit
()
unsafe
{
Self
::
uninit
()
}
}
pub
unsafe
fn
zeroed
()
->
Self
{
Self
{
value
:
MaybeUninit
::
zeroed
(),
}
}
pub
unsafe
fn
uninit
()
->
Self
{
Self
{
value
:
MaybeUninit
::
uninit
(),
}
}
pub
const
fn
from
(
value
:
T
)
->
Self
{
Self
{
value
:
MaybeUninit
::
new
(
value
),
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment