forked from M-Labs/artiq-zynq
replace deprecated NoneError use
This commit is contained in:
parent
4b7dab18c3
commit
a31fac6c27
@ -1,6 +1,6 @@
|
|||||||
#![no_std]
|
#![no_std]
|
||||||
#![no_main]
|
#![no_main]
|
||||||
#![feature(alloc_error_handler, try_trait, never_type, panic_info_message)]
|
#![feature(alloc_error_handler, never_type, panic_info_message)]
|
||||||
|
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate log;
|
extern crate log;
|
||||||
|
@ -2,7 +2,7 @@ use alloc::{collections::BTreeMap,
|
|||||||
format,
|
format,
|
||||||
string::{String, ToString},
|
string::{String, ToString},
|
||||||
vec::Vec};
|
vec::Vec};
|
||||||
use core::{option::NoneError, slice, str};
|
use core::{slice, str};
|
||||||
|
|
||||||
use core_io::{Error as IoError, Write};
|
use core_io::{Error as IoError, Write};
|
||||||
use cslice::AsCSlice;
|
use cslice::AsCSlice;
|
||||||
@ -65,12 +65,6 @@ pub enum Error {
|
|||||||
DmaError(DmaError),
|
DmaError(DmaError),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<NoneError> for Error {
|
|
||||||
fn from(_: NoneError) -> Error {
|
|
||||||
Error::KernelNotFound
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl From<IoError> for Error {
|
impl From<IoError> for Error {
|
||||||
fn from(_value: IoError) -> Error {
|
fn from(_value: IoError) -> Error {
|
||||||
Error::SubkernelIoError
|
Error::SubkernelIoError
|
||||||
@ -316,7 +310,7 @@ impl<'a> Manager<'_> {
|
|||||||
complete: false,
|
complete: false,
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
self.kernels.get_mut(&id)?
|
self.kernels.get_mut(&id).ok_or_else(|| Error::KernelNotFound)?
|
||||||
} else {
|
} else {
|
||||||
kernel
|
kernel
|
||||||
}
|
}
|
||||||
@ -329,7 +323,7 @@ impl<'a> Manager<'_> {
|
|||||||
complete: false,
|
complete: false,
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
self.kernels.get_mut(&id)?
|
self.kernels.get_mut(&id).ok_or_else(|| Error::KernelNotFound)?
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
kernel.library.extend(&data[0..data_len]);
|
kernel.library.extend(&data[0..data_len]);
|
||||||
@ -396,7 +390,7 @@ impl<'a> Manager<'_> {
|
|||||||
if self.session.id == id && self.session.kernel_state == KernelState::Loaded {
|
if self.session.id == id && self.session.kernel_state == KernelState::Loaded {
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
if !self.kernels.get(&id)?.complete {
|
if !self.kernels.get(&id).ok_or_else(|| Error::KernelNotFound)?.complete {
|
||||||
return Err(Error::KernelNotFound);
|
return Err(Error::KernelNotFound);
|
||||||
}
|
}
|
||||||
self.session = Session::new(id);
|
self.session = Session::new(id);
|
||||||
@ -404,7 +398,7 @@ impl<'a> Manager<'_> {
|
|||||||
|
|
||||||
self.control
|
self.control
|
||||||
.tx
|
.tx
|
||||||
.send(kernel::Message::LoadRequest(self.kernels.get(&id)?.library.clone()));
|
.send(kernel::Message::LoadRequest(self.kernels.get(&id).ok_or_else(|| Error::KernelNotFound)?.library.clone()));
|
||||||
let reply = self.control.rx.recv();
|
let reply = self.control.rx.recv();
|
||||||
match reply {
|
match reply {
|
||||||
kernel::Message::LoadCompleted => Ok(()),
|
kernel::Message::LoadCompleted => Ok(()),
|
||||||
|
Loading…
Reference in New Issue
Block a user