forked from M-Labs/artiq
1
0
Fork 0

runtime: get rid of config_dummy.rs. NFC.

Use the same strategy as elsewhere.
This commit is contained in:
whitequark 2017-10-02 03:20:50 +00:00
parent 73c76ebb9a
commit fd07c3f4d7
3 changed files with 189 additions and 183 deletions

View File

@ -1,3 +1,5 @@
#[cfg(has_spiflash)]
mod imp {
use core::str; use core::str;
use std::btree_map::BTreeMap; use std::btree_map::BTreeMap;
use byteorder::{ByteOrder, BigEndian}; use byteorder::{ByteOrder, BigEndian};
@ -35,7 +37,7 @@ mod lock {
} }
} }
pub use self::lock::Lock; use self::lock::Lock;
struct Iter<'a> { struct Iter<'a> {
data: &'a [u8], data: &'a [u8],
@ -190,3 +192,29 @@ pub fn erase() -> Result<(), ()> {
Ok(()) Ok(())
} }
}
#[cfg(not(has_spiflash))]
mod imp {
pub fn read<F: FnOnce(Result<&[u8], ()>) -> R, R>(_key: &str, f: F) -> R {
f(Err(()))
}
pub fn read_str<F: FnOnce(Result<&str, ()>) -> R, R>(_key: &str, f: F) -> R {
f(Err(()))
}
pub fn write(_key: &str, _value: &[u8]) -> Result<(), ()> {
Err(())
}
pub fn remove(_key: &str) -> Result<(), ()> {
Err(())
}
pub fn erase() -> Result<(), ()> {
Err(())
}
}
pub use self::imp::*;

View File

@ -1,19 +0,0 @@
pub fn read<F: FnOnce(Result<&[u8], ()>) -> R, R>(_key: &str, f: F) -> R {
f(Err(()))
}
pub fn read_str<F: FnOnce(Result<&str, ()>) -> R, R>(_key: &str, f: F) -> R {
f(Err(()))
}
pub fn write(_key: &str, _value: &[u8]) -> Result<(), ()> {
Err(())
}
pub fn remove(_key: &str) -> Result<(), ()> {
Err(())
}
pub fn erase() -> Result<(), ()> {
Err(())
}

View File

@ -35,10 +35,7 @@ macro_rules! borrow_mut {
}) })
} }
#[cfg(has_spiflash)]
mod config; mod config;
#[cfg(not(has_spiflash))]
#[path="config_dummy.rs"] mod config;
mod ethmac; mod ethmac;
mod rtio_mgt; mod rtio_mgt;