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 committed by Sebastien Bourdeauducq
parent 0ede5d8638
commit 6cbf8786d8
3 changed files with 189 additions and 183 deletions

View File

@ -1,3 +1,5 @@
#[cfg(has_spiflash)]
mod imp {
use core::str;
use std::btree_map::BTreeMap;
use byteorder::{ByteOrder, BigEndian};
@ -35,7 +37,7 @@ mod lock {
}
}
pub use self::lock::Lock;
use self::lock::Lock;
struct Iter<'a> {
data: &'a [u8],
@ -190,3 +192,29 @@ pub fn erase() -> Result<(), ()> {
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

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