Merge branch 'renamed-const_fn-feature' into 'master'

Specify feature(const_fn_trait_bound)

See merge request redox-os/syscall!65
This commit is contained in:
Jeremy Soller
2021-06-15 19:53:59 +00:00
2 changed files with 8 additions and 5 deletions

View File

@@ -22,17 +22,19 @@ pub trait Io {
}
}
pub struct ReadOnly<I: Io> {
pub struct ReadOnly<I> {
inner: I
}
impl<I: Io> ReadOnly<I> {
impl<I> ReadOnly<I> {
pub const fn new(inner: I) -> ReadOnly<I> {
ReadOnly {
inner: inner
}
}
}
impl<I: Io> ReadOnly<I> {
#[inline(always)]
pub fn read(&self) -> I::Value {
self.inner.read()
@@ -44,17 +46,19 @@ impl<I: Io> ReadOnly<I> {
}
}
pub struct WriteOnly<I: Io> {
pub struct WriteOnly<I> {
inner: I
}
impl<I: Io> WriteOnly<I> {
impl<I> WriteOnly<I> {
pub const fn new(inner: I) -> WriteOnly<I> {
WriteOnly {
inner: inner
}
}
}
impl<I: Io> WriteOnly<I> {
#[inline(always)]
pub fn write(&mut self, value: I::Value) {
self.inner.write(value)

View File

@@ -1,6 +1,5 @@
#![feature(asm)]
#![feature(llvm_asm)]
#![feature(const_fn)] // see https://github.com/rust-lang/rfcs/pull/2632
#![cfg_attr(not(test), no_std)]
#[cfg(test)]